def test_parse_run_log(run_log): job = LocalQuantumJob("local:job/Test-Job-Name", run_log) assert job.run_log == run_log assert job.metrics() == { "Cost": [-4.034, -3.957], "iteration_number": [0.0, 1.0], "timestamp": [1633027264.5406773, 1633027288.6284382], }
def test_run_log(mock_dir, run_log): mock_dir.return_value = True with patch("builtins.open", mock_open()) as file_open: file_read = file_open() file_read.read.return_value = run_log job = LocalQuantumJob("local:job/Test-Job-Name") assert job.run_log == run_log assert job.metrics() == { "Cost": [-4.034, -3.957], "iteration_number": [0.0, 1.0], "timestamp": [1633027264.5406773, 1633027288.6284382], }