diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2012-12-27 22:32:19 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2012-12-27 22:32:19 (GMT) |
commit | 8876145fabec7924981f36019f0c2e45f73fbad2 (patch) | |
tree | b1deaa1df7385024bdc3e7093c442421f09411f1 | |
parent | 270767b2ceb5452d052b280eb1b174d7a32d43f5 (diff) | |
download | cpython-8876145fabec7924981f36019f0c2e45f73fbad2.zip cpython-8876145fabec7924981f36019f0c2e45f73fbad2.tar.gz cpython-8876145fabec7924981f36019f0c2e45f73fbad2.tar.bz2 |
Issue #16793. Replace deprecated unittest asserts with modern counterparts.
-rw-r--r-- | Lib/ctypes/test/test_bitfields.py | 8 | ||||
-rw-r--r-- | Lib/test/test_calendar.py | 2 | ||||
-rw-r--r-- | Lib/test/test_int.py | 10 | ||||
-rw-r--r-- | Lib/test/test_mutex.py | 2 | ||||
-rw-r--r-- | Lib/test/test_tarfile.py | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/Lib/ctypes/test/test_bitfields.py b/Lib/ctypes/test/test_bitfields.py index 090fb4d..3bcc67f 100644 --- a/Lib/ctypes/test/test_bitfields.py +++ b/Lib/ctypes/test/test_bitfields.py @@ -246,9 +246,9 @@ class BitFieldTest(unittest.TestCase): _fields_ = [("a", c_uint32, 32)] x = X() x.a = 10 - self.assertEquals(x.a, 10) + self.assertEqual(x.a, 10) x.a = 0xFDCBA987 - self.assertEquals(x.a, 0xFDCBA987) + self.assertEqual(x.a, 0xFDCBA987) @unittest.skipUnless(hasattr(ctypes, "c_uint64"), "c_int64 is required") def test_uint64(self): @@ -256,9 +256,9 @@ class BitFieldTest(unittest.TestCase): _fields_ = [("a", c_uint64, 64)] x = X() x.a = 10 - self.assertEquals(x.a, 10) + self.assertEqual(x.a, 10) x.a = 0xFEDCBA9876543211 - self.assertEquals(x.a, 0xFEDCBA9876543211) + self.assertEqual(x.a, 0xFEDCBA9876543211) if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index 5d6549c..0f91d29 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -261,7 +261,7 @@ class CalendarTestCase(unittest.TestCase): return calendar.LocaleHTMLCalendar(locale='').formatmonthname(2010, 10) new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10) - self.assertEquals(old_october, new_october) + self.assertEqual(old_october, new_october) def test_itermonthdates(self): # ensure itermonthdates doesn't overflow after datetime.MAXYEAR diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py index 099640a..f1d4f95 100644 --- a/Lib/test/test_int.py +++ b/Lib/test/test_int.py @@ -347,8 +347,8 @@ class IntTestCases(IntLongCommonTests, unittest.TestCase): for x in values: msg = 'x has value %s and type %s' % (x, type(x).__name__) try: - self.assertEquals(int(x), 100, msg=msg) - self.assertEquals(int(x, 2), 4, msg=msg) + self.assertEqual(int(x), 100, msg=msg) + self.assertEqual(int(x, 2), 4, msg=msg) except TypeError, err: raise AssertionError('For %s got TypeError: %s' % (type(x).__name__, err)) @@ -373,10 +373,10 @@ class IntTestCases(IntLongCommonTests, unittest.TestCase): # expects x to be a string if base is given. @test_support.cpython_only def test_int_base_without_x_returns_0(self): - self.assertEquals(int(base=6), 0) + self.assertEqual(int(base=6), 0) # Even invalid bases don't raise an exception. - self.assertEquals(int(base=1), 0) - self.assertEquals(int(base=1000), 0) + self.assertEqual(int(base=1), 0) + self.assertEqual(int(base=1000), 0) @test_support.cpython_only def test_small_ints(self): diff --git a/Lib/test/test_mutex.py b/Lib/test/test_mutex.py index 2882213..030080e 100644 --- a/Lib/test/test_mutex.py +++ b/Lib/test/test_mutex.py @@ -14,7 +14,7 @@ class MutexTest(unittest.TestCase): m.lock(called_by_mutex2, "eggs") def called_by_mutex2(some_data): - self.assertEquals(some_data, "eggs") + self.assertEqual(some_data, "eggs") self.assertTrue(m.test(), "mutex not held") self.assertTrue(ready_for_2, "called_by_mutex2 called too soon") diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index a3685ea..9ec7744 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -858,7 +858,7 @@ class WriteTest(WriteTestBase): tar = tarfile.open(tmpname, "r") for t in tar: - self.assert_(t.name == "." or t.name.startswith("./")) + self.assertTrue(t.name == "." or t.name.startswith("./")) tar.close() finally: os.chdir(cwd) |