diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-08-05 17:05:06 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-08-05 17:05:06 +0200 |
commit | e58ed78b291889578477741fb5ad5f05bf914d6b (patch) | |
tree | 73fa7be33210f4e9ee033f662486643e041dfdd0 /_test/test_float.py | |
parent | 992aecee297f7fe781eddc715fff6d7f5bbed875 (diff) | |
download | ruamel.yaml-e58ed78b291889578477741fb5ad5f05bf914d6b.tar.gz |
undid miswrapping of tests
Diffstat (limited to '_test/test_float.py')
-rw-r--r-- | _test/test_float.py | 78 |
1 files changed, 26 insertions, 52 deletions
diff --git a/_test/test_float.py b/_test/test_float.py index b115eb3..146793b 100644 --- a/_test/test_float.py +++ b/_test/test_float.py @@ -11,8 +11,7 @@ from roundtrip import round_trip, dedent, round_trip_load, round_trip_dump # NO class TestFloat: def test_round_trip_non_exp(self): - data = round_trip( - """\ + data = round_trip("""\ - 1.0 - 1.00 - 23.100 @@ -22,8 +21,7 @@ class TestFloat: - 42. - -42. - +42. - """ - ) + """) print(data) assert 0.999 < data[0] < 1.001 assert 0.999 < data[1] < 1.001 @@ -36,8 +34,7 @@ class TestFloat: assert 41.999 < data[8] < 42.001 def test_round_trip_zeros_0(self): - data = round_trip( - """\ + data = round_trip("""\ - 0. - +0. - -0. @@ -47,8 +44,7 @@ class TestFloat: - 0.00 - +0.00 - -0.00 - """ - ) + """) print(data) for d in data: assert -0.00001 < d < 0.00001 @@ -56,112 +52,94 @@ class TestFloat: # @pytest.mark.xfail(strict=True) def test_round_trip_zeros_1(self): # not sure if this should be supported, but it is - data = round_trip( - """\ + data = round_trip("""\ - 00.0 - +00.0 - -00.0 - """ - ) + """) print(data) for d in data: assert -0.00001 < d < 0.00001 def Xtest_round_trip_non_exp_trailing_dot(self): - data = round_trip( - """\ - """ - ) + data = round_trip("""\ + """) print(data) def test_round_trip_exp_00(self): - data = round_trip( - """\ + data = round_trip("""\ - 42e56 - 42E56 - 42.0E56 - +42.0e56 - 42.0E+056 - +42.00e+056 - """ - ) + """) print(data) for d in data: assert 41.99e56 < d < 42.01e56 # @pytest.mark.xfail(strict=True) def test_round_trip_exp_00f(self): - data = round_trip( - """\ + data = round_trip("""\ - 42.E56 - """ - ) + """) print(data) for d in data: assert 41.99e56 < d < 42.01e56 def test_round_trip_exp_01(self): - data = round_trip( - """\ + data = round_trip("""\ - -42e56 - -42E56 - -42.0e56 - -42.0E+056 - """ - ) + """) print(data) for d in data: assert -41.99e56 > d > -42.01e56 def test_round_trip_exp_02(self): - data = round_trip( - """\ + data = round_trip("""\ - 42e-56 - 42E-56 - 42.0E-56 - +42.0e-56 - 42.0E-056 - +42.0e-056 - """ - ) + """) print(data) for d in data: assert 41.99e-56 < d < 42.01e-56 def test_round_trip_exp_03(self): - data = round_trip( - """\ + data = round_trip("""\ - -42e-56 - -42E-56 - -42.0e-56 - -42.0E-056 - """ - ) + """) print(data) for d in data: assert -41.99e-56 > d > -42.01e-56 def test_round_trip_exp_04(self): - round_trip( - """\ + round_trip("""\ - 1.2e+34 - 1.23e+034 - 1.230e+34 - 1.023e+34 - -1.023e+34 - 250e6 - """ - ) + """) def test_round_trip_exp_05(self): - data = round_trip( - """\ + data = round_trip("""\ - 3.0517578123e-56 - 3.0517578123E-56 - 3.0517578123e-056 - 3.0517578123E-056 - """ - ) + """) print(data) for d in data: assert 3.0517578122e-56 < d < 3.0517578124e-56 @@ -170,23 +148,19 @@ class TestFloat: from ruamel.yaml.error import MantissaNoDotYAML1_1Warning with pytest.warns(MantissaNoDotYAML1_1Warning): - round_trip_load( - """\ + round_trip_load("""\ %YAML 1.1 --- - 1e6 - """ - ) + """) class TestCalculations(object): def test_mul_00(self): # issue 149 reported by jan.brezina@tul.cz - d = round_trip_load( - """\ + d = round_trip_load("""\ - 0.1 - """ - ) + """) d[0] *= -1 x = round_trip_dump(d) assert x == '- -0.1\n' |