diff options
Diffstat (limited to '_test/test_float.py')
-rw-r--r-- | _test/test_float.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/_test/test_float.py b/_test/test_float.py index 8257208..582ccf0 100644 --- a/_test/test_float.py +++ b/_test/test_float.py @@ -1,6 +1,6 @@ # coding: utf-8 -import pytest # NOQA +import pytest # type: ignore # NOQA from roundtrip import round_trip, dedent, round_trip_load, round_trip_dump # NOQA @@ -8,7 +8,7 @@ from roundtrip import round_trip, dedent, round_trip_load, round_trip_dump # NO class TestFloat: - def test_round_trip_non_exp(self): + def test_round_trip_non_exp(self) -> None: data = round_trip("""\ - 1.0 - 1.00 @@ -22,6 +22,8 @@ class TestFloat: - .5 - +.5 - -.5 + - !!float '42' + - !!float '-42' """) print(data) assert 0.999 < data[0] < 1.001 @@ -36,8 +38,10 @@ class TestFloat: assert .49 < data[9] < .51 assert .49 < data[10] < .51 assert -.51 < data[11] < -.49 + assert 41.99 < data[12] < 42.01 + assert 41.99 < -data[13] < 42.01 - def test_round_trip_zeros_0(self): + def test_round_trip_zeros_0(self) -> None: data = round_trip("""\ - 0. - +0. @@ -53,12 +57,13 @@ class TestFloat: for d in data: assert -0.00001 < d < 0.00001 - def Xtest_round_trip_non_exp_trailing_dot(self): + def test_round_trip_exp_trailing_dot(self) -> None: data = round_trip("""\ + - 3.e4 """) print(data) - def test_yaml_1_1_no_dot(self): + def test_yaml_1_1_no_dot(self) -> None: from ruamel.yaml.error import MantissaNoDotYAML1_1Warning with pytest.warns(MantissaNoDotYAML1_1Warning): @@ -69,8 +74,8 @@ class TestFloat: """) -class TestCalculations(object): - def test_mul_00(self): +class TestCalculations: + def test_mul_00(self) -> None: # issue 149 reported by jan.brezina@tul.cz d = round_trip_load("""\ - 0.1 |