Skip to content

Commit

Permalink
Fix Python tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rturrado committed Nov 13, 2024
1 parent 060d80a commit e930c24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/test_libqasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, file_name: str, program: str, analyzer_api_name: str, expecte
"<unknown>",
"version 3;qubit[5] q;bit[5] b;H q[0:4];b = measure q",
"parse_string_to_json",
'''{"Program":{"version":{"Version":{"items":"3","source_location":"<unknown>:1:9..10"}},"block":{"GlobalBlock":{"statements":[{"Variable":{"name":{"Identifier":{"name":"q"}},"typ":{"Type":{"name":{"Keyword":{"name":"qubit"}},"size":{"IntegerLiteral":{"value":"5"}},"source_location":"<unknown>:1:11..19"}},"annotations":[],"source_location":"<unknown>:1:20..21"}},{"Variable":{"name":{"Identifier":{"name":"b"}},"typ":{"Type":{"name":{"Keyword":{"name":"bit"}},"size":{"IntegerLiteral":{"value":"5"}},"source_location":"<unknown>:1:22..28"}},"annotations":[],"source_location":"<unknown>:1:29..30"}},{"GateInstruction":{"gate":{"Gate":{"name":{"Identifier":{"name":"H"}},"gate":"-","parameter":"-","annotations":[],"source_location":"<unknown>:1:31..32"}},"operands":{"ExpressionList":{"items":[{"Index":{"expr":{"Identifier":{"name":"q"}},"indices":{"IndexList":{"items":[{"IndexRange":{"first":{"IntegerLiteral":{"value":"0","source_location":"<unknown>:1:35..36"}},"last":{"IntegerLiteral":{"value":"4","source_location":"<unknown>:1:37..38"}}}}]}},"source_location":"<unknown>:1:33..34"}}]}},"annotations":[],"source_location":"<unknown>:1:31..32"}},{"NonGateInstruction":{"name":{"Keyword":{"name":"measure"}},"operands":{"ExpressionList":{"items":[{"Identifier":{"name":"b","source_location":"<unknown>:1:40..41"}},{"Identifier":{"name":"q","source_location":"<unknown>:1:52..53"}}]}},"annotations":[],"source_location":"<unknown>:1:44..51"}}]}}}}'''
'''{"Program":{"version":{"Version":{"items":"3","source_location":"<unknown>:1:9..10"}},"block":{"GlobalBlock":{"statements":[{"Variable":{"name":{"Identifier":{"name":"q"}},"typ":{"Type":{"name":{"Keyword":{"name":"qubit"}},"size":{"IntegerLiteral":{"value":"5"}},"source_location":"<unknown>:1:11..19"}},"annotations":[],"source_location":"<unknown>:1:20..21"}},{"Variable":{"name":{"Identifier":{"name":"b"}},"typ":{"Type":{"name":{"Keyword":{"name":"bit"}},"size":{"IntegerLiteral":{"value":"5"}},"source_location":"<unknown>:1:22..28"}},"annotations":[],"source_location":"<unknown>:1:29..30"}},{"GateInstruction":{"gate":{"Gate":{"name":{"Identifier":{"name":"H"}},"gate":"-","parameter":"-","annotations":[],"source_location":"<unknown>:1:31..32"}},"operands":{"ExpressionList":{"items":[{"Index":{"expr":{"Identifier":{"name":"q"}},"indices":{"IndexList":{"items":[{"IndexRange":{"first":{"IntegerLiteral":{"value":"0","source_location":"<unknown>:1:35..36"}},"last":{"IntegerLiteral":{"value":"4","source_location":"<unknown>:1:37..38"}}}}]}},"source_location":"<unknown>:1:33..34"}}]}},"annotations":[],"source_location":"<unknown>:1:31..32"}},{"NonGateInstruction":{"name":{"Keyword":{"name":"measure"}},"operands":{"ExpressionList":{"items":[{"Identifier":{"name":"b","source_location":"<unknown>:1:40..41"}},{"Identifier":{"name":"q","source_location":"<unknown>:1:52..53"}}]}},"parameter":"-","annotations":[],"source_location":"<unknown>:1:44..51"}}]}}}}'''
),
TestDataEntry(
"q_gym.cq",
Expand All @@ -34,7 +34,7 @@ def __init__(self, file_name: str, program: str, analyzer_api_name: str, expecte
"spin_q.cq",
"version 3;qubit[5] q;bit[5] b;H q[0:4];b = measure q",
"analyze_string_to_json",
'''{"Program":{"api_version":"3.0","version":{"Version":{"items":"3"}},"block":{"Block":{"statements":[{"GateInstruction":{"instruction_ref":"H(qubit array)","gate":{"Gate":{"name":"H","gate":"-","parameter":"-","annotations":[]}},"operands":[{"IndexRef":{"variable":{"Variable":{"name":"q","typ":{"QubitArray":{"size":"5"}},"annotations":[]}},"indices":[{"ConstInt":{"value":"0"}},{"ConstInt":{"value":"1"}},{"ConstInt":{"value":"2"}},{"ConstInt":{"value":"3"}},{"ConstInt":{"value":"4"}}]}}],"annotations":[]}},{"NonGateInstruction":{"instruction_ref":"measure(bit array, qubit array)","name":"measure","operands":[{"VariableRef":{"variable":{"Variable":{"name":"b","typ":{"BitArray":{"size":"5"}},"annotations":[]}}}},{"VariableRef":{"variable":{"Variable":{"name":"q","typ":{"QubitArray":{"size":"5"}},"annotations":[]}}}}],"annotations":[]}}]}},"variables":[{"Variable":{"name":"q","typ":{"QubitArray":{"size":"5"}},"annotations":[]}},{"Variable":{"name":"b","typ":{"BitArray":{"size":"5"}},"annotations":[]}}]}}'''
'''{"Program":{"api_version":"3.0","version":{"Version":{"items":"3"}},"block":{"Block":{"statements":[{"GateInstruction":{"instruction_ref":"H(qubit array)","gate":{"Gate":{"name":"H","gate":"-","parameter":"-","annotations":[]}},"operands":[{"IndexRef":{"variable":{"Variable":{"name":"q","typ":{"QubitArray":{"size":"5"}},"annotations":[]}},"indices":[{"ConstInt":{"value":"0"}},{"ConstInt":{"value":"1"}},{"ConstInt":{"value":"2"}},{"ConstInt":{"value":"3"}},{"ConstInt":{"value":"4"}}]}}],"annotations":[]}},{"NonGateInstruction":{"instruction_ref":"measure(bit array, qubit array)","name":"measure","operands":[{"VariableRef":{"variable":{"Variable":{"name":"b","typ":{"BitArray":{"size":"5"}},"annotations":[]}}}},{"VariableRef":{"variable":{"Variable":{"name":"q","typ":{"QubitArray":{"size":"5"}},"annotations":[]}}}}],"parameter":"-","annotations":[]}}]}},"variables":[{"Variable":{"name":"q","typ":{"QubitArray":{"size":"5"}},"annotations":[]}},{"Variable":{"name":"b","typ":{"BitArray":{"size":"5"}},"annotations":[]}}]}}'''
)
]

Expand Down

0 comments on commit e930c24

Please sign in to comment.