summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_float.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r--Lib/test/test_float.py60
1 files changed, 30 insertions, 30 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index e74e892..af5e13c 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -136,27 +136,27 @@ class GeneralFloatCases(unittest.TestCase):
def test_float_containment(self):
floats = (INF, -INF, 0.0, 1.0, NAN)
for f in floats:
- self.assert_(f in [f], "'%r' not in []" % f)
- self.assert_(f in (f,), "'%r' not in ()" % f)
- self.assert_(f in {f}, "'%r' not in set()" % f)
- self.assert_(f in {f: None}, "'%r' not in {}" % f)
+ self.assertTrue(f in [f], "'%r' not in []" % f)
+ self.assertTrue(f in (f,), "'%r' not in ()" % f)
+ self.assertTrue(f in {f}, "'%r' not in set()" % f)
+ self.assertTrue(f in {f: None}, "'%r' not in {}" % f)
self.assertEqual([f].count(f), 1, "[].count('%r') != 1" % f)
- self.assert_(f in floats, "'%r' not in container" % f)
+ self.assertTrue(f in floats, "'%r' not in container" % f)
for f in floats:
# nonidentical containers, same type, same contents
- self.assert_([f] == [f], "[%r] != [%r]" % (f, f))
- self.assert_((f,) == (f,), "(%r,) != (%r,)" % (f, f))
- self.assert_({f} == {f}, "{%r} != {%r}" % (f, f))
- self.assert_({f : None} == {f: None}, "{%r : None} != "
+ self.assertTrue([f] == [f], "[%r] != [%r]" % (f, f))
+ self.assertTrue((f,) == (f,), "(%r,) != (%r,)" % (f, f))
+ self.assertTrue({f} == {f}, "{%r} != {%r}" % (f, f))
+ self.assertTrue({f : None} == {f: None}, "{%r : None} != "
"{%r : None}" % (f, f))
# identical containers
l, t, s, d = [f], (f,), {f}, {f: None}
- self.assert_(l == l, "[%r] not equal to itself" % f)
- self.assert_(t == t, "(%r,) not equal to itself" % f)
- self.assert_(s == s, "{%r} not equal to itself" % f)
- self.assert_(d == d, "{%r : None} not equal to itself" % f)
+ self.assertTrue(l == l, "[%r] not equal to itself" % f)
+ self.assertTrue(t == t, "(%r,) not equal to itself" % f)
+ self.assertTrue(s == s, "{%r} not equal to itself" % f)
+ self.assertTrue(d == d, "{%r : None} not equal to itself" % f)
@@ -171,9 +171,9 @@ class FormatFunctionsTestCase(unittest.TestCase):
float.__setformat__('float', self.save_formats['float'])
def test_getformat(self):
- self.assert_(float.__getformat__('double') in
+ self.assertTrue(float.__getformat__('double') in
['unknown', 'IEEE, big-endian', 'IEEE, little-endian'])
- self.assert_(float.__getformat__('float') in
+ self.assertTrue(float.__getformat__('float') in
['unknown', 'IEEE, big-endian', 'IEEE, little-endian'])
self.assertRaises(ValueError, float.__getformat__, 'chicken')
self.assertRaises(TypeError, float.__getformat__, 1)
@@ -493,12 +493,12 @@ class RoundTestCase(unittest.TestCase):
# ways to create and represent inf and nan
class InfNanTest(unittest.TestCase):
def test_inf_from_str(self):
- self.assert_(isinf(float("inf")))
- self.assert_(isinf(float("+inf")))
- self.assert_(isinf(float("-inf")))
- self.assert_(isinf(float("infinity")))
- self.assert_(isinf(float("+infinity")))
- self.assert_(isinf(float("-infinity")))
+ self.assertTrue(isinf(float("inf")))
+ self.assertTrue(isinf(float("+inf")))
+ self.assertTrue(isinf(float("-inf")))
+ self.assertTrue(isinf(float("infinity")))
+ self.assertTrue(isinf(float("+infinity")))
+ self.assertTrue(isinf(float("-infinity")))
self.assertEqual(repr(float("inf")), "inf")
self.assertEqual(repr(float("+inf")), "inf")
@@ -545,9 +545,9 @@ class InfNanTest(unittest.TestCase):
self.assertEqual(str(-1e300 * 1e300), "-inf")
def test_nan_from_str(self):
- self.assert_(isnan(float("nan")))
- self.assert_(isnan(float("+nan")))
- self.assert_(isnan(float("-nan")))
+ self.assertTrue(isnan(float("nan")))
+ self.assertTrue(isnan(float("+nan")))
+ self.assertTrue(isnan(float("-nan")))
self.assertEqual(repr(float("nan")), "nan")
self.assertEqual(repr(float("+nan")), "nan")
@@ -581,14 +581,14 @@ class InfNanTest(unittest.TestCase):
self.assertEqual(str(-1e300 * 1e300 * 0), "nan")
def notest_float_nan(self):
- self.assert_(NAN.is_nan())
- self.failIf(INF.is_nan())
- self.failIf((0.).is_nan())
+ self.assertTrue(NAN.is_nan())
+ self.assertFalse(INF.is_nan())
+ self.assertFalse((0.).is_nan())
def notest_float_inf(self):
- self.assert_(INF.is_inf())
- self.failIf(NAN.is_inf())
- self.failIf((0.).is_inf())
+ self.assertTrue(INF.is_inf())
+ self.assertFalse(NAN.is_inf())
+ self.assertFalse((0.).is_inf())
fromHex = float.fromhex
toHex = float.hex