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.
........
This commit is contained in:
Ezio Melotti 2010-04-04 07:21:15 +00:00
parent 6f40184757
commit 4c28ddc2f2
1 changed files with 8 additions and 8 deletions

View File

@ -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