From a11865b8c6dff87bc18b23cded2ea554dd190bb7 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Sat, 20 Feb 2010 09:47:55 +0000 Subject: [PATCH] Merged revisions 78249 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78249 | ezio.melotti | 2010-02-20 11:40:07 +0200 (Sat, 20 Feb 2010) | 1 line Remove e assertIs definitions and use correct assert* methods. ........ --- Lib/test/test_bool.py | 6 ------ Lib/test/test_complex.py | 3 --- Lib/test/test_genericpath.py | 7 ++----- Lib/test/test_macpath.py | 38 ++++++++++++++++++------------------ Lib/test/test_posixpath.py | 10 ++++------ Lib/test/test_richcmp.py | 3 --- 6 files changed, 25 insertions(+), 42 deletions(-) diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py index 9784f083f66..a62ff8eff60 100644 --- a/Lib/test/test_bool.py +++ b/Lib/test/test_bool.py @@ -7,12 +7,6 @@ import os class BoolTest(unittest.TestCase): - def assertIs(self, a, b): - self.assertTrue(a is b) - - def assertIsNot(self, a, b): - self.assertTrue(a is not b) - def test_subclass(self): try: class C(bool): diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py index 9341016f217..a54e820f9eb 100644 --- a/Lib/test/test_complex.py +++ b/Lib/test/test_complex.py @@ -65,9 +65,6 @@ class ComplexTest(unittest.TestCase): self.assertCloseAbs(x.real, y.real, eps) self.assertCloseAbs(x.imag, y.imag, eps) - def assertIs(self, a, b): - self.assertTrue(a is b) - def check_div(self, x, y): """Compute complex z=x*y, and check that z/x==y and z/y==x.""" z = x * y diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py index 3be9c8992b5..ec722f3c1e9 100644 --- a/Lib/test/test_genericpath.py +++ b/Lib/test/test_genericpath.py @@ -5,9 +5,6 @@ import genericpath class AllCommonTest(unittest.TestCase): - def assertIs(self, a, b): - self.assertTrue(a is b) - def test_commonprefix(self): self.assertEqual( genericpath.commonprefix([]), @@ -50,8 +47,8 @@ class AllCommonTest(unittest.TestCase): f.close() self.assertEqual(d, b"foobar") - self.assertTrue( - genericpath.getctime(support.TESTFN) <= + self.assertLessEqual( + genericpath.getctime(support.TESTFN), genericpath.getmtime(support.TESTFN) ) finally: diff --git a/Lib/test/test_macpath.py b/Lib/test/test_macpath.py index e13865d80cd..2c737583274 100644 --- a/Lib/test/test_macpath.py +++ b/Lib/test/test_macpath.py @@ -29,12 +29,12 @@ class MacPathTestCase(unittest.TestCase): def test_commonprefix(self): commonprefix = macpath.commonprefix - self.assertTrue(commonprefix(["home:swenson:spam", "home:swen:spam"]) - == "home:swen") - self.assertTrue(commonprefix([":home:swen:spam", ":home:swen:eggs"]) - == ":home:swen:") - self.assertTrue(commonprefix([":home:swen:spam", ":home:swen:spam"]) - == ":home:swen:spam") + self.assertEqual(commonprefix(["home:swenson:spam", "home:swen:spam"]), + "home:swen") + self.assertEqual(commonprefix([":home:swen:spam", ":home:swen:eggs"]), + ":home:swen:") + self.assertEqual(commonprefix([":home:swen:spam", ":home:swen:spam"]), + ":home:swen:spam") self.assertTrue(commonprefix([b"home:swenson:spam", b"home:swen:spam"]) == b"home:swen") @@ -45,13 +45,13 @@ class MacPathTestCase(unittest.TestCase): def test_split(self): split = macpath.split - self.assertEquals(split("foo:bar"), + self.assertEqual(split("foo:bar"), ('foo:', 'bar')) - self.assertEquals(split("conky:mountpoint:foo:bar"), + self.assertEqual(split("conky:mountpoint:foo:bar"), ('conky:mountpoint:foo', 'bar')) - self.assertEquals(split(":"), ('', '')) - self.assertEquals(split(":conky:mountpoint:"), + self.assertEqual(split(":"), ('', '')) + self.assertEqual(split(":conky:mountpoint:"), (':conky:mountpoint', '')) self.assertEquals(split(b"foo:bar"), @@ -79,21 +79,21 @@ class MacPathTestCase(unittest.TestCase): def test_splitdrive(self): splitdrive = macpath.splitdrive - self.assertEquals(splitdrive("foo:bar"), ('', 'foo:bar')) - self.assertEquals(splitdrive(":foo:bar"), ('', ':foo:bar')) + self.assertEqual(splitdrive("foo:bar"), ('', 'foo:bar')) + self.assertEqual(splitdrive(":foo:bar"), ('', ':foo:bar')) self.assertEquals(splitdrive(b"foo:bar"), (b'', b'foo:bar')) self.assertEquals(splitdrive(b":foo:bar"), (b'', b':foo:bar')) def test_splitext(self): splitext = macpath.splitext - self.assertEquals(splitext(":foo.ext"), (':foo', '.ext')) - self.assertEquals(splitext("foo:foo.ext"), ('foo:foo', '.ext')) - self.assertEquals(splitext(".ext"), ('.ext', '')) - self.assertEquals(splitext("foo.ext:foo"), ('foo.ext:foo', '')) - self.assertEquals(splitext(":foo.ext:"), (':foo.ext:', '')) - self.assertEquals(splitext(""), ('', '')) - self.assertEquals(splitext("foo.bar.ext"), ('foo.bar', '.ext')) + self.assertEqual(splitext(":foo.ext"), (':foo', '.ext')) + self.assertEqual(splitext("foo:foo.ext"), ('foo:foo', '.ext')) + self.assertEqual(splitext(".ext"), ('.ext', '')) + self.assertEqual(splitext("foo.ext:foo"), ('foo.ext:foo', '')) + self.assertEqual(splitext(":foo.ext:"), (':foo.ext:', '')) + self.assertEqual(splitext(""), ('', '')) + self.assertEqual(splitext("foo.bar.ext"), ('foo.bar', '.ext')) self.assertEquals(splitext(b":foo.ext"), (b':foo', b'.ext')) self.assertEquals(splitext(b"foo:foo.ext"), (b'foo:foo', b'.ext')) diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index f2277c93d0b..1b1167a0061 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -25,9 +25,6 @@ class PosixPathTest(unittest.TestCase): support.unlink(support.TESTFN + suffix) safe_rmdir(support.TESTFN + suffix) - def assertIs(self, a, b): - self.assertTrue(a is b) - def test_normcase(self): # Check that normcase() is idempotent p = "FoO/./BaR" @@ -229,8 +226,8 @@ class PosixPathTest(unittest.TestCase): f.close() self.assertEqual(d, b"foobar") - self.assertTrue( - posixpath.getctime(support.TESTFN) <= + self.assertLessEqual( + posixpath.getctime(support.TESTFN), posixpath.getmtime(support.TESTFN) ) finally: @@ -560,7 +557,8 @@ class PosixPathTest(unittest.TestCase): self.assertEqual(realpath(ABSTFN + "/link-y/.."), ABSTFN + "/k") # Relative path. os.chdir(dirname(ABSTFN)) - self.assertEqual(realpath(basename(ABSTFN) + "/link-y/.."), ABSTFN + "/k") + self.assertEqual(realpath(basename(ABSTFN) + "/link-y/.."), + ABSTFN + "/k") finally: os.chdir(old_path) support.unlink(ABSTFN + "/link-y") diff --git a/Lib/test/test_richcmp.py b/Lib/test/test_richcmp.py index a788c60dc43..aec8bf33278 100644 --- a/Lib/test/test_richcmp.py +++ b/Lib/test/test_richcmp.py @@ -279,9 +279,6 @@ class DictTest(unittest.TestCase): class ListTest(unittest.TestCase): - def assertIs(self, a, b): - self.assertTrue(a is b) - def test_coverage(self): # exercise all comparisons for lists x = [42]