def test_probability() -> None: state = qf.w_state(3) qf.print_state(state) prob = state.probabilities() qf.print_probabilities(state) assert np.isclose(prob.sum(), 1)
def test_probability(): state = qf.w_state(3) qf.print_state(state) prob = state.probabilities() qf.print_probabilities(state) assert qf.asarray(prob).sum() == ALMOST_ONE
def test_print_probabilities() -> None: f = io.StringIO() state = qf.w_state(5) qf.print_probabilities(state, file=f)
def test_print_probabilities(): f = io.StringIO() state = qf.w_state(5) qf.print_probabilities(state, file=f) print(f.getvalue())
def main(): """CLI""" print(prepare_w16.__doc__) print("states : probabilities") ket = prepare_w16() qf.print_probabilities(ket)