Skip to content

Escape both <> characters in SVG test labels#6056

Merged
tanujkhattar merged 6 commits intoquantumlib:masterfrom
pavoljuhas:fix-both-lt-and-gt-in-svg
Apr 7, 2023
Merged

Escape both <> characters in SVG test labels#6056
tanujkhattar merged 6 commits intoquantumlib:masterfrom
pavoljuhas:fix-both-lt-and-gt-in-svg

Conversation

@pavoljuhas
Copy link
Copy Markdown
Collaborator

Also parametrize test_gate_with_less_greater_str so it is easier to
add checks for more wire symbols later.

Also parametrize test_gate_with_less_greater_str so it is easier to
add checks for more wire symbols.
@pavoljuhas pavoljuhas requested review from a team, cduck and vtomole as code owners April 7, 2023 20:12
@CirqBot CirqBot added the size: S 10< lines changed <50 label Apr 7, 2023
Comment thread cirq-core/cirq/contrib/svg/svg.py Outdated
@@ -23,10 +23,7 @@ def fixup_text(text: str):
if '[cirq.VirtualTag()]' in text:
# https://github.com/quantumlib/Cirq/issues/2905
return text.replace('[cirq.VirtualTag()]', '')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we change the if statements above as well so that we don't return as soon as a single if matches?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sure, of course! Done. I have left the first short-circuit if as it does not matter when the string is dropped.

@tanujkhattar tanujkhattar merged commit ae62250 into quantumlib:master Apr 7, 2023
@pavoljuhas pavoljuhas deleted the fix-both-lt-and-gt-in-svg branch April 7, 2023 23:29
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
* Test escaping both `<>` symbols in SVG

Also parametrize test_gate_with_less_greater_str so it is easier to
add checks for more wire symbols.

* Escape both `<>` symbols when used as symbols in SVG

* Skip typecheck at import of IPython.display

* Test short-circuit fixup of a multi-line SVG text

Strings with `\n` are replaced with '?'.

* Test SVG replacements are all in effect

* Apply all fixups to SVG string labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants