From 88987a8755b5ba0ea82a23d809f7ad55613814ba Mon Sep 17 00:00:00 2001 From: Robert Smallshire Date: Wed, 15 Apr 2015 09:32:20 +0200 Subject: [PATCH] Tightened up the tests now that Hypothesis performance has improved. --- test/test_float.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/test_float.py b/test/test_float.py index cf5a6b7..e345b87 100644 --- a/test/test_float.py +++ b/test/test_float.py @@ -1,9 +1,9 @@ from math import trunc, floor import unittest -from hypothesis import given, assume, example +from hypothesis import given, assume import math -from hypothesis.specifiers import integers_in_range, floats_in_range, just +from hypothesis.specifiers import integers_in_range, floats_in_range from segpy.portability import byte_string from segpy.ibm_float import (ieee2ibm, ibm2ieee, MAX_IBM_FLOAT, SMALLEST_POSITIVE_NORMAL_IBM_FLOAT, @@ -198,7 +198,7 @@ class TestIBMFloat(unittest.TestCase): self.assertTrue(almost_equal(f, float(ibm), epsilon=EPSILON_IBM_FLOAT)) @given(integers_in_range(0, MAX_EXACT_INTEGER_IBM_FLOAT - 1), - floats_in_range(0.0, 0.9)) + floats_in_range(0.0, 1.0)) def test_trunc_above_zero(self, i, f): assume(f != 1.0) ieee = i + f @@ -206,7 +206,7 @@ class TestIBMFloat(unittest.TestCase): self.assertEqual(trunc(ibm), i) @given(integers_in_range(MIN_EXACT_INTEGER_IBM_FLOAT + 1, 0), - floats_in_range(0.0, 0.9)) + floats_in_range(0.0, 1.0)) def test_trunc_below_zero(self, i, f): assume(f != 1.0) ieee = i - f @@ -214,7 +214,7 @@ class TestIBMFloat(unittest.TestCase): self.assertEqual(trunc(ibm), i) @given(integers_in_range(MIN_EXACT_INTEGER_IBM_FLOAT, MAX_EXACT_INTEGER_IBM_FLOAT - 1), - floats_in_range(0.0, 0.9)) + floats_in_range(0.0, 1.0)) def test_ceil(self, i, f): assume(f != 1.0) ieee = i + f @@ -222,7 +222,7 @@ class TestIBMFloat(unittest.TestCase): self.assertEqual(math.ceil(ibm), i + 1) @given(integers_in_range(MIN_EXACT_INTEGER_IBM_FLOAT, MAX_EXACT_INTEGER_IBM_FLOAT - 1), - floats_in_range(0.0, 0.9)) + floats_in_range(0.0, 1.0)) def test_floor(self, i, f): assume(f != 1.0) ieee = i + f @@ -359,5 +359,6 @@ class TestIBMFloat(unittest.TestCase): self.assertTrue(almost_equal(ieee_c, ibm_c, epsilon=EPSILON_IBM_FLOAT)) + if __name__ == '__main__': unittest.main()