diff --git a/qiskit-superstaq/qiskit_superstaq/superstaq_job_test.py b/qiskit-superstaq/qiskit_superstaq/superstaq_job_test.py index 8116948d1..b485c5131 100644 --- a/qiskit-superstaq/qiskit_superstaq/superstaq_job_test.py +++ b/qiskit-superstaq/qiskit_superstaq/superstaq_job_test.py @@ -222,6 +222,12 @@ def test_index_compiled_circuits(backend: qss.SuperstaqBackend) -> None: assert job.compiled_circuits(0).metadata == {"test_label": "test_data"} mocked_get_job.assert_called_once() + # After fetching the job info once it shouldn't be refreshed again (so no need to mock) + assert job.compiled_circuits() == [single_qc] + assert job.compiled_circuits()[0].metadata == {"test_label": "test_data"} + assert job.compiled_circuits(index=0) == single_qc + assert job.compiled_circuits(0).metadata == {"test_label": "test_data"} + job = qss.SuperstaqJob(backend=backend, job_id="123abc,456xyz,789cba") with mock.patch( "general_superstaq.superstaq_client._SuperstaqClient.get_job", return_value=response @@ -233,6 +239,13 @@ def test_index_compiled_circuits(backend: qss.SuperstaqBackend) -> None: assert job.compiled_circuits(index=2).metadata == {"test_label": "test_data"} mocked_get_job.assert_called_once() + # After fetching the job info once it shouldn't be refreshed again (so no need to mock) + assert job.compiled_circuits() == qc_list + assert job.compiled_circuits(index=2) == single_qc + for circ in job.compiled_circuits(): + assert circ.metadata == {"test_label": "test_data"} + assert job.compiled_circuits(index=2).metadata == {"test_label": "test_data"} + def test_input_circuits(backend: qss.SuperstaqBackend) -> None: response = mock_response("Queued")