@@ -44,14 +44,77 @@ def test_list_jobs_all(capsys):
4444
4545 # Expected output using tabulate
4646 table = [
47- ["1234" , "ibm" , "ibmq_qasm_simulator" , "Quantum Volume" , "2021-09-01T12:00:00" ],
48- ["5678" , "ionq" , "ionq_simulator" , "Quantum Volume" , "2021-09-02T12:00:00" ],
47+ ["1234" , "ibm" , "ibmq_qasm_simulator" , "Quantum Volume" , None , "2021-09-01T12:00:00" ],
48+ ["5678" , "ionq" , "ionq_simulator" , "Quantum Volume" , None , "2021-09-02T12:00:00" ],
4949 ]
5050 expected_output = tabulate (table , headers = LIST_JOBS_HEADERS , tablefmt = "grid" ) + "\n "
5151
5252 assert captured .out == expected_output
5353
5454
55+ def test_list_jobs_prefers_max_qubits_for_qft (capsys ):
56+ mock_jobs = [
57+ MetriqGymJob (
58+ id = "qft1" ,
59+ device_name = "local_sim" ,
60+ provider_name = "local" ,
61+ job_type = JobType .QUANTUM_FOURIER_TRANSFORM ,
62+ dispatch_time = datetime .fromisoformat ("2021-09-01T12:00:00" ),
63+ params = {"max_qubits" : 6 },
64+ data = {},
65+ )
66+ ]
67+
68+ list_jobs (mock_jobs , show_index = False , show_suite_id = False )
69+ captured = capsys .readouterr ()
70+
71+ table = [["qft1" , "local" , "local_sim" , "Quantum Fourier Transform" , 6 , "2021-09-01T12:00:00" ]]
72+ expected_output = tabulate (table , headers = LIST_JOBS_HEADERS , tablefmt = "grid" ) + "\n "
73+ assert captured .out == expected_output
74+
75+
76+ def test_list_jobs_uses_width_alias_for_num_qubits (capsys ):
77+ mock_jobs = [
78+ MetriqGymJob (
79+ id = "mc1" ,
80+ device_name = "local_sim" ,
81+ provider_name = "local" ,
82+ job_type = JobType .MIRROR_CIRCUITS ,
83+ dispatch_time = datetime .fromisoformat ("2021-09-01T12:00:00" ),
84+ params = {"width" : 11 , "max_qubits" : 20 },
85+ data = {},
86+ )
87+ ]
88+
89+ list_jobs (mock_jobs , show_index = False , show_suite_id = False )
90+ captured = capsys .readouterr ()
91+
92+ table = [["mc1" , "local" , "local_sim" , "Mirror Circuits" , 11 , "2021-09-01T12:00:00" ]]
93+ expected_output = tabulate (table , headers = LIST_JOBS_HEADERS , tablefmt = "grid" ) + "\n "
94+ assert captured .out == expected_output
95+
96+
97+ def test_list_jobs_uses_qubits_alias_for_num_qubits (capsys ):
98+ mock_jobs = [
99+ MetriqGymJob (
100+ id = "q2" ,
101+ device_name = "local_sim" ,
102+ provider_name = "local" ,
103+ job_type = JobType .WIT ,
104+ dispatch_time = datetime .fromisoformat ("2021-09-01T12:00:00" ),
105+ params = {"qubits" : 9 },
106+ data = {},
107+ )
108+ ]
109+
110+ list_jobs (mock_jobs , show_index = False , show_suite_id = False )
111+ captured = capsys .readouterr ()
112+
113+ table = [["q2" , "local" , "local_sim" , "WIT" , 9 , "2021-09-01T12:00:00" ]]
114+ expected_output = tabulate (table , headers = LIST_JOBS_HEADERS , tablefmt = "grid" ) + "\n "
115+ assert captured .out == expected_output
116+
117+
55118def test_list_jobs_no_jobs (capsys ):
56119 """Test listing jobs when no jobs are recorded."""
57120 # Mock no jobs
0 commit comments