Skip to content

Commit

Permalink
Change test expected
Browse files Browse the repository at this point in the history
  • Loading branch information
fmowl10 committed Oct 12, 2023
1 parent 1d915ec commit 1e1cb0a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion qiskit_classroom/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def add_new_line(strings: list[str]) -> str:
class ConverterWorker:
"""worker for convert expression and visualize expression"""

# pylint: disable=too-many-arguments
def __init__(
self,
from_expression: QuantumExpression,
Expand Down Expand Up @@ -174,7 +175,10 @@ def generate_visualization_code(self) -> str:
if self.to_expression is QuantumExpression.MATRIX:
return add_new_line(
[
"for gate, name in zip(reversed(result['gate']), reversed(result['name'])):",
(
"for gate, name in zip(reversed(result['gate']),"
+ "reversed(result['name'])):"
),
"\totimes=' \\\\otimes '",
"""\tprint('\\stackrel{' + otimes.join(name[1]) +'}' + f'{{{gate}}}')""",
"print(f\"= \\stackrel{{result}}{{{result['result']}}}\")"
Expand Down
5 changes: 3 additions & 2 deletions tests/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
"converter = ConversionService(conversion_type='QC_TO_MATRIX',"
+ " option={'print': 'raw'})\n"
+ f"result = converter.convert(input_value={VALUE_NAME})",
"for gate, name in zip(reversed(result['gate']), reversed(result['name'])):\n"
+ "\tprint(f'{gate.strip()}_' + '{' + \"\\\\otimes \".join(name[1]) + '}')\n",
"for gate, name in zip(reversed(result['gate']),reversed(result['name'])):\n"
+ "\totimes=' \\\\otimes '\n"
+ "\tprint('\\stackrel{' + otimes.join(name[1]) +'}' + f'{{{gate}}}')\n",
]

MATRIX_TO_QC_EXPECTED = [
Expand Down

0 comments on commit 1e1cb0a

Please sign in to comment.