summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_getargs2.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_getargs2.py')
-rw-r--r--Lib/test/test_getargs2.py142
1 files changed, 71 insertions, 71 deletions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 34d8ee0..3ffc1cc 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -68,68 +68,68 @@ class Unsigned_TestCase(unittest.TestCase):
from _testcapi import getargs_b
# b returns 'unsigned char', and does range checking (0 ... UCHAR_MAX)
self.assertRaises(TypeError, getargs_b, 3.14)
- self.failUnlessEqual(99, getargs_b(Long()))
- self.failUnlessEqual(99, getargs_b(Int()))
+ self.assertEqual(99, getargs_b(Long()))
+ self.assertEqual(99, getargs_b(Int()))
self.assertRaises(OverflowError, getargs_b, -1)
- self.failUnlessEqual(0, getargs_b(0))
- self.failUnlessEqual(UCHAR_MAX, getargs_b(UCHAR_MAX))
+ self.assertEqual(0, getargs_b(0))
+ self.assertEqual(UCHAR_MAX, getargs_b(UCHAR_MAX))
self.assertRaises(OverflowError, getargs_b, UCHAR_MAX + 1)
- self.failUnlessEqual(42, getargs_b(42))
- self.failUnlessEqual(42, getargs_b(42))
+ self.assertEqual(42, getargs_b(42))
+ self.assertEqual(42, getargs_b(42))
self.assertRaises(OverflowError, getargs_b, VERY_LARGE)
def test_B(self):
from _testcapi import getargs_B
# B returns 'unsigned char', no range checking
self.assertRaises(TypeError, getargs_B, 3.14)
- self.failUnlessEqual(99, getargs_B(Long()))
- self.failUnlessEqual(99, getargs_B(Int()))
+ self.assertEqual(99, getargs_B(Long()))
+ self.assertEqual(99, getargs_B(Int()))
- self.failUnlessEqual(UCHAR_MAX, getargs_B(-1))
- self.failUnlessEqual(UCHAR_MAX, getargs_B(-1))
- self.failUnlessEqual(0, getargs_B(0))
- self.failUnlessEqual(UCHAR_MAX, getargs_B(UCHAR_MAX))
- self.failUnlessEqual(0, getargs_B(UCHAR_MAX+1))
+ self.assertEqual(UCHAR_MAX, getargs_B(-1))
+ self.assertEqual(UCHAR_MAX, getargs_B(-1))
+ self.assertEqual(0, getargs_B(0))
+ self.assertEqual(UCHAR_MAX, getargs_B(UCHAR_MAX))
+ self.assertEqual(0, getargs_B(UCHAR_MAX+1))
- self.failUnlessEqual(42, getargs_B(42))
- self.failUnlessEqual(42, getargs_B(42))
- self.failUnlessEqual(UCHAR_MAX & VERY_LARGE, getargs_B(VERY_LARGE))
+ self.assertEqual(42, getargs_B(42))
+ self.assertEqual(42, getargs_B(42))
+ self.assertEqual(UCHAR_MAX & VERY_LARGE, getargs_B(VERY_LARGE))
def test_H(self):
from _testcapi import getargs_H
# H returns 'unsigned short', no range checking
self.assertRaises(TypeError, getargs_H, 3.14)
- self.failUnlessEqual(99, getargs_H(Long()))
- self.failUnlessEqual(99, getargs_H(Int()))
+ self.assertEqual(99, getargs_H(Long()))
+ self.assertEqual(99, getargs_H(Int()))
- self.failUnlessEqual(USHRT_MAX, getargs_H(-1))
- self.failUnlessEqual(0, getargs_H(0))
- self.failUnlessEqual(USHRT_MAX, getargs_H(USHRT_MAX))
- self.failUnlessEqual(0, getargs_H(USHRT_MAX+1))
+ self.assertEqual(USHRT_MAX, getargs_H(-1))
+ self.assertEqual(0, getargs_H(0))
+ self.assertEqual(USHRT_MAX, getargs_H(USHRT_MAX))
+ self.assertEqual(0, getargs_H(USHRT_MAX+1))
- self.failUnlessEqual(42, getargs_H(42))
- self.failUnlessEqual(42, getargs_H(42))
+ self.assertEqual(42, getargs_H(42))
+ self.assertEqual(42, getargs_H(42))
- self.failUnlessEqual(VERY_LARGE & USHRT_MAX, getargs_H(VERY_LARGE))
+ self.assertEqual(VERY_LARGE & USHRT_MAX, getargs_H(VERY_LARGE))
def test_I(self):
from _testcapi import getargs_I
# I returns 'unsigned int', no range checking
self.assertRaises(TypeError, getargs_I, 3.14)
- self.failUnlessEqual(99, getargs_I(Long()))
- self.failUnlessEqual(99, getargs_I(Int()))
+ self.assertEqual(99, getargs_I(Long()))
+ self.assertEqual(99, getargs_I(Int()))
- self.failUnlessEqual(UINT_MAX, getargs_I(-1))
- self.failUnlessEqual(0, getargs_I(0))
- self.failUnlessEqual(UINT_MAX, getargs_I(UINT_MAX))
- self.failUnlessEqual(0, getargs_I(UINT_MAX+1))
+ self.assertEqual(UINT_MAX, getargs_I(-1))
+ self.assertEqual(0, getargs_I(0))
+ self.assertEqual(UINT_MAX, getargs_I(UINT_MAX))
+ self.assertEqual(0, getargs_I(UINT_MAX+1))
- self.failUnlessEqual(42, getargs_I(42))
- self.failUnlessEqual(42, getargs_I(42))
+ self.assertEqual(42, getargs_I(42))
+ self.assertEqual(42, getargs_I(42))
- self.failUnlessEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE))
+ self.assertEqual(VERY_LARGE & UINT_MAX, getargs_I(VERY_LARGE))
def test_k(self):
from _testcapi import getargs_k
@@ -139,47 +139,47 @@ class Unsigned_TestCase(unittest.TestCase):
self.assertRaises(TypeError, getargs_k, Long())
self.assertRaises(TypeError, getargs_k, Int())
- self.failUnlessEqual(ULONG_MAX, getargs_k(-1))
- self.failUnlessEqual(0, getargs_k(0))
- self.failUnlessEqual(ULONG_MAX, getargs_k(ULONG_MAX))
- self.failUnlessEqual(0, getargs_k(ULONG_MAX+1))
+ self.assertEqual(ULONG_MAX, getargs_k(-1))
+ self.assertEqual(0, getargs_k(0))
+ self.assertEqual(ULONG_MAX, getargs_k(ULONG_MAX))
+ self.assertEqual(0, getargs_k(ULONG_MAX+1))
- self.failUnlessEqual(42, getargs_k(42))
- self.failUnlessEqual(42, getargs_k(42))
+ self.assertEqual(42, getargs_k(42))
+ self.assertEqual(42, getargs_k(42))
- self.failUnlessEqual(VERY_LARGE & ULONG_MAX, getargs_k(VERY_LARGE))
+ self.assertEqual(VERY_LARGE & ULONG_MAX, getargs_k(VERY_LARGE))
class Signed_TestCase(unittest.TestCase):
def test_i(self):
from _testcapi import getargs_i
# i returns 'int', and does range checking (INT_MIN ... INT_MAX)
self.assertRaises(TypeError, getargs_i, 3.14)
- self.failUnlessEqual(99, getargs_i(Long()))
- self.failUnlessEqual(99, getargs_i(Int()))
+ self.assertEqual(99, getargs_i(Long()))
+ self.assertEqual(99, getargs_i(Int()))
self.assertRaises(OverflowError, getargs_i, INT_MIN-1)
- self.failUnlessEqual(INT_MIN, getargs_i(INT_MIN))
- self.failUnlessEqual(INT_MAX, getargs_i(INT_MAX))
+ self.assertEqual(INT_MIN, getargs_i(INT_MIN))
+ self.assertEqual(INT_MAX, getargs_i(INT_MAX))
self.assertRaises(OverflowError, getargs_i, INT_MAX+1)
- self.failUnlessEqual(42, getargs_i(42))
- self.failUnlessEqual(42, getargs_i(42))
+ self.assertEqual(42, getargs_i(42))
+ self.assertEqual(42, getargs_i(42))
self.assertRaises(OverflowError, getargs_i, VERY_LARGE)
def test_l(self):
from _testcapi import getargs_l
# l returns 'long', and does range checking (LONG_MIN ... LONG_MAX)
self.assertRaises(TypeError, getargs_l, 3.14)
- self.failUnlessEqual(99, getargs_l(Long()))
- self.failUnlessEqual(99, getargs_l(Int()))
+ self.assertEqual(99, getargs_l(Long()))
+ self.assertEqual(99, getargs_l(Int()))
self.assertRaises(OverflowError, getargs_l, LONG_MIN-1)
- self.failUnlessEqual(LONG_MIN, getargs_l(LONG_MIN))
- self.failUnlessEqual(LONG_MAX, getargs_l(LONG_MAX))
+ self.assertEqual(LONG_MIN, getargs_l(LONG_MIN))
+ self.assertEqual(LONG_MAX, getargs_l(LONG_MAX))
self.assertRaises(OverflowError, getargs_l, LONG_MAX+1)
- self.failUnlessEqual(42, getargs_l(42))
- self.failUnlessEqual(42, getargs_l(42))
+ self.assertEqual(42, getargs_l(42))
+ self.assertEqual(42, getargs_l(42))
self.assertRaises(OverflowError, getargs_l, VERY_LARGE)
def test_n(self):
@@ -191,12 +191,12 @@ class Signed_TestCase(unittest.TestCase):
self.assertRaises(TypeError, getargs_n, Int())
self.assertRaises(OverflowError, getargs_n, PY_SSIZE_T_MIN-1)
- self.failUnlessEqual(PY_SSIZE_T_MIN, getargs_n(PY_SSIZE_T_MIN))
- self.failUnlessEqual(PY_SSIZE_T_MAX, getargs_n(PY_SSIZE_T_MAX))
+ self.assertEqual(PY_SSIZE_T_MIN, getargs_n(PY_SSIZE_T_MIN))
+ self.assertEqual(PY_SSIZE_T_MAX, getargs_n(PY_SSIZE_T_MAX))
self.assertRaises(OverflowError, getargs_n, PY_SSIZE_T_MAX+1)
- self.failUnlessEqual(42, getargs_n(42))
- self.failUnlessEqual(42, getargs_n(42))
+ self.assertEqual(42, getargs_n(42))
+ self.assertEqual(42, getargs_n(42))
self.assertRaises(OverflowError, getargs_n, VERY_LARGE)
@@ -204,18 +204,18 @@ class LongLong_TestCase(unittest.TestCase):
def test_L(self):
from _testcapi import getargs_L
# L returns 'long long', and does range checking (LLONG_MIN ... LLONG_MAX)
- self.failUnlessRaises(TypeError, getargs_L, "Hello")
- self.failUnlessEqual(3, getargs_L(3.14))
- self.failUnlessEqual(99, getargs_L(Long()))
- self.failUnlessEqual(99, getargs_L(Int()))
+ self.assertRaises(TypeError, getargs_L, "Hello")
+ self.assertEqual(3, getargs_L(3.14))
+ self.assertEqual(99, getargs_L(Long()))
+ self.assertEqual(99, getargs_L(Int()))
self.assertRaises(OverflowError, getargs_L, LLONG_MIN-1)
- self.failUnlessEqual(LLONG_MIN, getargs_L(LLONG_MIN))
- self.failUnlessEqual(LLONG_MAX, getargs_L(LLONG_MAX))
+ self.assertEqual(LLONG_MIN, getargs_L(LLONG_MIN))
+ self.assertEqual(LLONG_MAX, getargs_L(LLONG_MAX))
self.assertRaises(OverflowError, getargs_L, LLONG_MAX+1)
- self.failUnlessEqual(42, getargs_L(42))
- self.failUnlessEqual(42, getargs_L(42))
+ self.assertEqual(42, getargs_L(42))
+ self.assertEqual(42, getargs_L(42))
self.assertRaises(OverflowError, getargs_L, VERY_LARGE)
def test_K(self):
@@ -224,14 +224,14 @@ class LongLong_TestCase(unittest.TestCase):
self.assertRaises(TypeError, getargs_K, 3.14)
self.assertRaises(TypeError, getargs_K, Long())
self.assertRaises(TypeError, getargs_K, Int())
- self.failUnlessEqual(ULLONG_MAX, getargs_K(ULLONG_MAX))
- self.failUnlessEqual(0, getargs_K(0))
- self.failUnlessEqual(0, getargs_K(ULLONG_MAX+1))
+ self.assertEqual(ULLONG_MAX, getargs_K(ULLONG_MAX))
+ self.assertEqual(0, getargs_K(0))
+ self.assertEqual(0, getargs_K(ULLONG_MAX+1))
- self.failUnlessEqual(42, getargs_K(42))
- self.failUnlessEqual(42, getargs_K(42))
+ self.assertEqual(42, getargs_K(42))
+ self.assertEqual(42, getargs_K(42))
- self.failUnlessEqual(VERY_LARGE & ULLONG_MAX, getargs_K(VERY_LARGE))
+ self.assertEqual(VERY_LARGE & ULLONG_MAX, getargs_K(VERY_LARGE))
class Tuple_TestCase(unittest.TestCase):