def test_hz_to_period_throws_if_zero_or_less(): # This is a bit magic-looking, but all it is saying is that # the test will pass if code inside the `with` block raises a ValueError! with pytest.raises(ValueError): toymir.hz_to_period(0)
def test_hz_to_period_float(): expected = 0.1 assert toymir.hz_to_period(10) == expected
def test_hz_to_period_array(): expected = [0.1, 0.01, 0.001] assert np.allclose(toymir.hz_to_period([10, 100, 1000]), expected)
def test_hz_to_period_throws_of_zero_or_less(): with pytest.raises(ValueError): toymir.hz_to_period(0)