diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-11-20 19:04:17 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-11-20 19:04:17 (GMT) |
commit | b3aedd48621ed9d33b5f42f946b256bce4a50673 (patch) | |
tree | 2297c8ebce1b09621e1d98096c1603896d9a0f0c /Lib/test/string_tests.py | |
parent | b8bc439b2093add9b313bcca2cc507a2d0e87764 (diff) | |
download | cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.zip cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.gz cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.bz2 |
#9424: Replace deprecated assert* methods in the Python test suite.
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r-- | Lib/test/string_tests.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 4c6515b..1cc36d8 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -67,7 +67,7 @@ class BaseTest(unittest.TestCase): else: obj = subtype(obj) realresult = getattr(obj, methodname)(*args) - self.assert_(obj is not realresult) + self.assertIsNot(obj, realresult) # check that obj.method(*args) raises exc def checkraises(self, exc, obj, methodname, *args): @@ -1197,34 +1197,34 @@ class MixinStrUnicodeTest: pass s1 = subclass("abcd") s2 = t().join([s1]) - self.assert_(s1 is not s2) - self.assert_(type(s2) is t) + self.assertIsNot(s1, s2) + self.assertIs(type(s2), t) s1 = t("abcd") s2 = t().join([s1]) - self.assert_(s1 is s2) + self.assertIs(s1, s2) # Should also test mixed-type join. if t is str: s1 = subclass("abcd") s2 = "".join([s1]) - self.assert_(s1 is not s2) - self.assert_(type(s2) is t) + self.assertIsNot(s1, s2) + self.assertIs(type(s2), t) s1 = t("abcd") s2 = "".join([s1]) - self.assert_(s1 is s2) + self.assertIs(s1, s2) ## elif t is str8: ## s1 = subclass("abcd") ## s2 = "".join([s1]) -## self.assert_(s1 is not s2) -## self.assert_(type(s2) is str) # promotes! +## self.assertIsNot(s1, s2) +## self.assertIs(type(s2), str) # promotes! ## s1 = t("abcd") ## s2 = "".join([s1]) -## self.assert_(s1 is not s2) -## self.assert_(type(s2) is str) # promotes! +## self.assertIsNot(s1, s2) +## self.assertIs(type(s2), str) # promotes! else: self.fail("unexpected type for MixinStrUnicodeTest %r" % t) |