From 1e1cb0acd49881138a723504a683c2f044baa367 Mon Sep 17 00:00:00 2001 From: fmowl10 Date: Thu, 12 Oct 2023 10:43:26 +0900 Subject: [PATCH] Change test expected --- qiskit_classroom/worker.py | 6 +++++- tests/test_worker.py | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/qiskit_classroom/worker.py b/qiskit_classroom/worker.py index 5f22ef1..5cb71ca 100644 --- a/qiskit_classroom/worker.py +++ b/qiskit_classroom/worker.py @@ -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, @@ -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']}}}\")" diff --git a/tests/test_worker.py b/tests/test_worker.py index 3e4e3d4..878adf3 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -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 = [