def test_negative_state(self, e): """Test if function raises a ``ValueError`` when the given excited state contains negative values.""" with pytest.raises( ValueError, match="The excited state must not contain negative values"): samples, state, _ = e dynamics.prob(samples, [-i for i in state])
def test_n_modes(self, e): """Test if function raises a ``ValueError`` when the number of modes in the samples and the state are different.""" with pytest.raises( ValueError, match= "The number of modes in the samples and the excited state must be" ): samples, state, _ = e dynamics.prob(samples, state + [0])
def test_empty_samples(self, e): """Test if function raises a ``ValueError`` when the samples list is empty.""" with pytest.raises(ValueError, match="The samples list must not be empty"): _, state, _ = e dynamics.prob([], state)
def test_empty_state(self, e): """Test if function raises a ``ValueError`` when the given state is empty.""" with pytest.raises(ValueError, match="The excited state list must not be empty"): samples, _, _ = e dynamics.prob(samples, [])
def test_correct_prob(self, e): """Test if the function returns the correct probability""" samples, state, pref = e p = dynamics.prob(samples, state) assert p == pref