Skip to content

Conversation

@95-martin-orion
Copy link
Collaborator

Fixes #5524.

Based on #5525 discussion, we don't need to pin quimb (yet!), but testing exact strings for quimb objects is asking for trouble. This reduces the tests to substring checks, which should be less vulnerable to minor quimb movements (e.g. this passes with both quimb v1.3.0 and v1.4.0).

@95-martin-orion 95-martin-orion requested review from a team, cduck and vtomole as code owners June 15, 2022 21:37
@CirqBot CirqBot added the size: M 50< lines changed <250 label Jun 15, 2022
assert p.text_pretty == text, f"{p.text_pretty} != {text}"


def assert_repr_pretty_contains(val: Any, substr: str, cycle: bool = False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to add a version that does a more general regex match as well:

def assert_repr_pretty_matches(val: Any, pattern: Union[str, re.Pattern], cycle: bool = False):
    p = FakePrinter()
    val._repr_pretty(p, cycle=cycle)
    assert re.match(pattern, p.text_pretty), ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appeal to YAGNI here - if someone needs it, they'll make it.

@95-martin-orion 95-martin-orion added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 15, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 15, 2022
@CirqBot CirqBot merged commit f2e2b7b into quantumlib:master Jun 15, 2022
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jun 15, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Fixes quantumlib#5524.

Based on quantumlib#5525 discussion, we don't need to pin quimb (yet!), but testing exact strings for quimb objects is asking for trouble. This reduces the tests to substring checks, which should be less vulnerable to minor quimb movements (e.g. this passes with both quimb v1.3.0 and v1.4.0).
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
Fixes quantumlib#5524.

Based on quantumlib#5525 discussion, we don't need to pin quimb (yet!), but testing exact strings for quimb objects is asking for trouble. This reduces the tests to substring checks, which should be less vulnerable to minor quimb movements (e.g. this passes with both quimb v1.3.0 and v1.4.0).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: M 50< lines changed <250

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quimb update breaks contrib

3 participants