← Về thư mục
tests/qiskit/test_scripts.py
- installed · function · L44-L49 — def installed(distribution: str) -> str | None
- ImportProbeTests · class · L52-L71 — class ImportProbeTests(unittest.TestCase)
- test_a_distribution_that_is_not_installed_has_no_version · method · L53-L54 — def test_a_distribution_that_is_not_installed_has_no_version(self) -> None
- test_an_installed_distribution_reports_its_version · method · L56-L57 — def test_an_installed_distribution_reports_its_version(self) -> None
- test_a_missing_module_is_reported_with_the_import_error · method · L59-L63 — def test_a_missing_module_is_reported_with_the_import_error(self) -> None
- test_an_importable_module_reports_where_it_came_from · method · L65-L71 — def test_an_importable_module_reports_where_it_came_from(self) -> None: # The module file is what distinguishes "installed" from "importable": # a broken optional environment must be nameable, not just falsy.
- EnvironmentReportTests · class · L74-L160 — class EnvironmentReportTests(unittest.TestCase)
- setUp · method · L75-L78 — def setUp(self) -> None
- test_qiskit_alone_is_required_by_default · method · L80-L86 — def test_qiskit_alone_is_required_by_default(self) -> None
- test_the_optional_extras_become_required_on_request · method · L88-L95 — def test_the_optional_extras_become_required_on_request(self) -> None
- test_the_core_api_smoke_check_passes_on_a_working_install · method · L97-L101 — def test_the_core_api_smoke_check_passes_on_a_working_install(self) -> None: # This is the whole point of the script: the imports it exercises are # the ones every documented workflow starts from.
- test_ok_is_exactly_the_absence_of_errors · method · L103-L105 — def test_ok_is_exactly_the_absence_of_errors(self) -> None: # main() turns this into the process exit code.
- test_a_healthy_environment_reports_no_errors · method · L107-L108 — def test_a_healthy_environment_reports_no_errors(self) -> None
- test_installed_versions_are_read_from_the_metadata · method · L110-L113 — def test_installed_versions_are_read_from_the_metadata(self) -> None
- test_version_drift_is_a_warning_but_an_error_under_strict · method · L115-L147 — def test_version_drift_is_a_warning_but_an_error_under_strict(self) -> None: # Expectations are derived from importlib.metadata and the script's own # published baseline, not from the report being checked.
- test_a_clean_namespace_reports_no_legacy_terra · method · L149-L154 — def test_a_clean_namespace_reports_no_legacy_terra(self) -> None: # Mixing qiskit-terra with qiskit 2.x is unrecoverable, so the script # must say so; with no terra installed the field stays empty.
- test_the_report_survives_json_serialisation · method · L156-L160 — def test_the_report_survives_json_serialisation(self) -> None: # --json is the machine-readable contract, so every value has to be # JSON-safe; an exception object smuggled into it would break it.
- ShotAndAngleValidationTests · class · L163-L186 — class ShotAndAngleValidationTests(unittest.TestCase)
- test_a_shot_count_inside_the_documented_range_is_accepted · method · L164-L169 — def test_a_shot_count_inside_the_documented_range_is_accepted(self) -> None
- test_shot_counts_outside_the_range_are_rejected · method · L171-L177 — def test_shot_counts_outside_the_range_are_rejected(self) -> None
- test_a_finite_angle_is_accepted_and_an_infinite_one_is_not · method · L179-L186 — def test_a_finite_angle_is_accepted_and_an_infinite_one_is_not(self) -> None
- LocalPrimitiveWorkflowTests · class · L189-L255 — class LocalPrimitiveWorkflowTests(unittest.TestCase)
- test_at_theta_pi_over_two_the_circuit_is_a_bell_state · method · L190-L194 — def test_at_theta_pi_over_two_the_circuit_is_a_bell_state(self) -> None: # ry(pi/2) then cx prepares (|00> + |11>)/sqrt(2). No other basis state # has any amplitude, so no other bitstring can ever be sampled.
- test_the_estimator_reproduces_the_analytic_expectation · method · L196-L215 — def test_the_estimator_reproduces_the_analytic_expectation(self) -> None: # = cos(theta) and = sin(theta) for that state, so the # observable 1.0ZI + 0.5XX has expectation cos + 0.5*sin exactly.
- test_a_zero_angle_leaves_both_qubits_in_the_ground_state · method · L217-L221 — def test_a_zero_angle_leaves_both_qubits_in_the_ground_state(self) -> None
- test_a_pi_angle_flips_both_qubits · method · L223-L227 — def test_a_pi_angle_flips_both_qubits(self) -> None: # ry(pi)|0> = |1> up to sign, and cx then flips the second qubit.
- test_every_requested_shot_is_accounted_for · method · L229-L232 — def test_every_requested_shot_is_accounted_for(self) -> None
- test_the_sampled_frequencies_match_the_analytic_probabilities · method · L234-L243 — def test_the_sampled_frequencies_match_the_analytic_probabilities(self) -> None
- test_the_same_seed_reproduces_the_same_counts · method · L245-L248 — def test_the_same_seed_reproduces_the_same_counts(self) -> None
- test_the_reported_parameter_order_is_the_circuit_binding_order · method · L250-L255 — def test_the_reported_parameter_order_is_the_circuit_binding_order(self) -> None: # Values are bound positionally, so a wrong order silently runs the # wrong circuit.
- QubitCountValidationTests · class · L258-L275 — class QubitCountValidationTests(unittest.TestCase)
- test_a_plausible_qubit_floor_is_accepted · method · L259-L261 — def test_a_plausible_qubit_floor_is_accepted(self) -> None
- test_an_implausible_qubit_floor_is_rejected · method · L263-L269 — def test_an_implausible_qubit_floor_is_rejected(self) -> None
- test_an_absent_distribution_reports_no_version · method · L271-L275 — def test_an_absent_distribution_reports_no_version(self) -> None
- RecordingService · class · L278-L290 — class RecordingService
- init · method · L281-L282 — def init(self) -> None
- backend · method · L284-L286 — def backend(self, name, **kwargs)
- least_busy · method · L288-L290 — def least_busy(self, **kwargs)
- BackendSelectionTests · class · L293-L330 — class BackendSelectionTests(unittest.TestCase)
- test_a_named_backend_is_fetched_by_name · method · L294-L300 — def test_a_named_backend_is_fetched_by_name(self) -> None
- test_without_a_name_the_least_busy_real_device_is_selected · method · L302-L316 — def test_without_a_name_the_least_busy_real_device_is_selected(self) -> None
- test_the_fractional_gate_flag_is_forwarded_only_when_it_is_set · method · L318-L330 — def test_the_fractional_gate_flag_is_forwarded_only_when_it_is_set(self) -> None: # None must mean "use the service default", not "disable" -- passing # use_fractional_gates=False changes which target you get back.
- BackendInspectionTests · class · L333-L381 — class BackendInspectionTests(unittest.TestCase)
- setUpClass · method · L337-L343 — def setUpClass(cls) -> None
- test_inspecting_a_backend_submits_no_jobs · method · L345-L347 — def test_inspecting_a_backend_submits_no_jobs(self) -> None: # The script's central promise: it reads a target, it never queues work.
- test_the_backend_identity_is_reported · method · L349-L351 — def test_the_backend_identity_is_reported(self) -> None
- test_a_five_qubit_line_has_eight_directed_coupling_edges · method · L353-L360 — def test_a_five_qubit_line_has_eight_directed_coupling_edges(self) -> None: # Manila is a linear chain 0-1-2-3-4: four links, both directions.
- test_the_reported_basis_gates_are_the_targets_own · method · L362-L366 — def test_the_reported_basis_gates_are_the_targets_own(self) -> None
- test_control_flow_support_is_reported_from_the_target · method · L368-L371 — def test_control_flow_support_is_reported_from_the_target(self) -> None
- test_fractional_gates_are_not_claimed_on_a_backend_without_them · method · L373-L377 — def test_fractional_gates_are_not_claimed_on_a_backend_without_them(self) -> None: # Manila's basis is rz/sx/x/cx, so neither rx nor rzz is present and the # report must not advertise fractional-gate support.
- test_the_report_survives_json_serialisation · method · L379-L381 — def test_the_report_survives_json_serialisation(self) -> None