diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-04-04 07:21:15 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-04-04 07:21:15 (GMT) |
commit | 4c28ddc2f2356e19d10b11eb671ad934e6d07f8b (patch) | |
tree | fd89c2f1300a78798fe221a817b4741adf87a41c /Lib/test | |
parent | 6f40184757d3b643d22559183051d2b2b4df0301 (diff) | |
download | cpython-4c28ddc2f2356e19d10b11eb671ad934e6d07f8b.zip cpython-4c28ddc2f2356e19d10b11eb671ad934e6d07f8b.tar.gz cpython-4c28ddc2f2356e19d10b11eb671ad934e6d07f8b.tar.bz2 |
Merged revisions 79740 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79740 | ezio.melotti | 2010-04-04 10:00:02 +0300 (Sun, 04 Apr 2010) | 1 line
Use more specific assert* methods in test_struct.
........
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_struct.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index 3d67abd..2222562 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -164,14 +164,14 @@ class StructTest(unittest.TestCase): self.assertEqual(signed_size, unsigned_size) # bounds for native integer sizes - self.assertTrue(struct.calcsize('b')==1) - self.assertTrue(2 <= struct.calcsize('h')) - self.assertTrue(4 <= struct.calcsize('l')) - self.assertTrue(struct.calcsize('h') <= struct.calcsize('i')) - self.assertTrue(struct.calcsize('i') <= struct.calcsize('l')) + self.assertEqual(struct.calcsize('b'), 1) + self.assertLessEqual(2, struct.calcsize('h')) + self.assertLessEqual(4, struct.calcsize('l')) + self.assertLessEqual(struct.calcsize('h'), struct.calcsize('i')) + self.assertLessEqual(struct.calcsize('i'), struct.calcsize('l')) if HAVE_LONG_LONG: - self.assertTrue(8 <= struct.calcsize('q')) - self.assertTrue(struct.calcsize('l') <= struct.calcsize('q')) + self.assertLessEqual(8, struct.calcsize('q')) + self.assertLessEqual(struct.calcsize('l'), struct.calcsize('q')) def test_integers(self): # Integer tests (bBhHiIlLqQ). @@ -209,7 +209,7 @@ class StructTest(unittest.TestCase): expected = x if self.signed and x < 0: expected += 1 << self.bitsize - self.assertTrue(expected >= 0) + self.assertGreaterEqual(expected, 0) expected = '%x' % expected if len(expected) & 1: expected = "0" + expected |