def test_partial_non_result(): Program( instructions=[CNot(control=0, target=1)], results=[ Expectation(targets=[1], observable=["x"]), CNot(control=0, target=1) ], )
def test_partial_non_rotation_basis_instruction(): Program( instructions=[CNot(control=0, target=1)], basis_rotation_instructions=[ Expectation(targets=[1], observable=["x"]), H(target=1) ], )
def test_rotation_basis_instruction(): Program(instructions=[CNot(control=0, target=1)], basis_rotation_instructions=[H(target=1)])
def test_instruction_with_results(): Program( instructions=[CNot(control=0, target=1)], results=[Expectation(targets=[1], observable=["x"])], )
def test_instruction_no_results(): program = Program(instructions=[CNot(control=0, target=1)]) assert Program.parse_raw(program.json()) == program
def test_partial_non_instruction(): Program(instructions=[CNot(control=0, target=1), "foo"])
def test_non_instruction(): Program(instructions=["foo"])
def test_missing_instructions_property(): Program()