[Python-checkins] r79742 - in python/branches/py3k: Lib/test/test_struct.py

ezio.melotti python-checkins at python.org
Sun Apr 4 09:21:15 CEST 2010


Author: ezio.melotti
Date: Sun Apr  4 09:21:15 2010
New Revision: 79742

Log:
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.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/test_struct.py

Modified: python/branches/py3k/Lib/test/test_struct.py
==============================================================================
--- python/branches/py3k/Lib/test/test_struct.py	(original)
+++ python/branches/py3k/Lib/test/test_struct.py	Sun Apr  4 09:21:15 2010
@@ -164,14 +164,14 @@
                 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 @@
                     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


More information about the Python-checkins mailing list