diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-11-21 01:30:29 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-11-21 01:30:29 (GMT) |
commit | 19f2aeba67b5b4dc4dfd589d02d4a0b0804e22ee (patch) | |
tree | 596b5a2c45b058ea3e0cdc49cb7539a21410b98d /Lib/importlib | |
parent | b65b4937e20be4a2d3311326909c77bbf2e1c4cd (diff) | |
download | cpython-19f2aeba67b5b4dc4dfd589d02d4a0b0804e22ee.zip cpython-19f2aeba67b5b4dc4dfd589d02d4a0b0804e22ee.tar.gz cpython-19f2aeba67b5b4dc4dfd589d02d4a0b0804e22ee.tar.bz2 |
Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line
#9424: Replace deprecated assert* methods in the Python test suite.
........
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/test/import_/test___package__.py | 4 | ||||
-rw-r--r-- | Lib/importlib/test/import_/test_caching.py | 6 | ||||
-rw-r--r-- | Lib/importlib/test/import_/test_fromlist.py | 24 | ||||
-rw-r--r-- | Lib/importlib/test/import_/test_meta_path.py | 12 |
4 files changed, 23 insertions, 23 deletions
diff --git a/Lib/importlib/test/import_/test___package__.py b/Lib/importlib/test/import_/test___package__.py index 2aa0814..4dc6901 100644 --- a/Lib/importlib/test/import_/test___package__.py +++ b/Lib/importlib/test/import_/test___package__.py @@ -41,7 +41,7 @@ class Using__package__(unittest.TestCase): module = import_util.import_('', globals={'__package__': 'pkg.fake'}, fromlist=['attr'], level=2) - self.assertEquals(module.__name__, 'pkg') + self.assertEqual(module.__name__, 'pkg') def test_using___name__(self): # [__name__] @@ -52,7 +52,7 @@ class Using__package__(unittest.TestCase): globals={'__name__': 'pkg.fake', '__path__': []}, fromlist=['attr'], level=2) - self.assertEquals(module.__name__, 'pkg') + self.assertEqual(module.__name__, 'pkg') def test_bad__package__(self): globals = {'__package__': '<not real>'} diff --git a/Lib/importlib/test/import_/test_caching.py b/Lib/importlib/test/import_/test_caching.py index 530b1a0..48dc643 100644 --- a/Lib/importlib/test/import_/test_caching.py +++ b/Lib/importlib/test/import_/test_caching.py @@ -54,7 +54,7 @@ class UseCache(unittest.TestCase): with self.create_mock('module') as mock: with util.import_state(meta_path=[mock]): module = import_util.import_('module') - self.assertEquals(id(module), id(sys.modules['module'])) + self.assertEqual(id(module), id(sys.modules['module'])) # See test_using_cache_after_loader() for reasoning. @import_util.importlib_only @@ -74,8 +74,8 @@ class UseCache(unittest.TestCase): with util.import_state(meta_path=[importer]): module = import_util.import_('pkg', fromlist=['module']) self.assertTrue(hasattr(module, 'module')) - self.assertEquals(id(module.module), - id(sys.modules['pkg.module'])) + self.assertEqual(id(module.module), + id(sys.modules['pkg.module'])) def test_main(): diff --git a/Lib/importlib/test/import_/test_fromlist.py b/Lib/importlib/test/import_/test_fromlist.py index 340235b..ddd355e 100644 --- a/Lib/importlib/test/import_/test_fromlist.py +++ b/Lib/importlib/test/import_/test_fromlist.py @@ -19,14 +19,14 @@ class ReturnValue(unittest.TestCase): with util.mock_modules('pkg.__init__', 'pkg.module') as importer: with util.import_state(meta_path=[importer]): module = import_util.import_('pkg.module') - self.assertEquals(module.__name__, 'pkg') + self.assertEqual(module.__name__, 'pkg') def test_return_from_from_import(self): # [from return] with util.mock_modules('pkg.__init__', 'pkg.module')as importer: with util.import_state(meta_path=[importer]): module = import_util.import_('pkg.module', fromlist=['attr']) - self.assertEquals(module.__name__, 'pkg.module') + self.assertEqual(module.__name__, 'pkg.module') class HandlingFromlist(unittest.TestCase): @@ -51,14 +51,14 @@ class HandlingFromlist(unittest.TestCase): with util.mock_modules('module') as importer: with util.import_state(meta_path=[importer]): module = import_util.import_('module', fromlist=['attr']) - self.assertEquals(module.__name__, 'module') + self.assertEqual(module.__name__, 'module') def test_unexistent_object(self): # [bad object] with util.mock_modules('module') as importer: with util.import_state(meta_path=[importer]): module = import_util.import_('module', fromlist=['non_existent']) - self.assertEquals(module.__name__, 'module') + self.assertEqual(module.__name__, 'module') self.assertTrue(not hasattr(module, 'non_existent')) def test_module_from_package(self): @@ -66,23 +66,23 @@ class HandlingFromlist(unittest.TestCase): with util.mock_modules('pkg.__init__', 'pkg.module') as importer: with util.import_state(meta_path=[importer]): module = import_util.import_('pkg', fromlist=['module']) - self.assertEquals(module.__name__, 'pkg') + self.assertEqual(module.__name__, 'pkg') self.assertTrue(hasattr(module, 'module')) - self.assertEquals(module.module.__name__, 'pkg.module') + self.assertEqual(module.module.__name__, 'pkg.module') def test_no_module_from_package(self): # [no module] with util.mock_modules('pkg.__init__') as importer: with util.import_state(meta_path=[importer]): module = import_util.import_('pkg', fromlist='non_existent') - self.assertEquals(module.__name__, 'pkg') + self.assertEqual(module.__name__, 'pkg') self.assertTrue(not hasattr(module, 'non_existent')) def test_empty_string(self): with util.mock_modules('pkg.__init__', 'pkg.mod') as importer: with util.import_state(meta_path=[importer]): module = import_util.import_('pkg.mod', fromlist=['']) - self.assertEquals(module.__name__, 'pkg.mod') + self.assertEqual(module.__name__, 'pkg.mod') def test_using_star(self): # [using *] @@ -90,7 +90,7 @@ class HandlingFromlist(unittest.TestCase): with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module'] module = import_util.import_('pkg', fromlist=['*']) - self.assertEquals(module.__name__, 'pkg') + self.assertEqual(module.__name__, 'pkg') self.assertTrue(hasattr(module, 'module')) self.assertEqual(module.module.__name__, 'pkg.module') @@ -101,11 +101,11 @@ class HandlingFromlist(unittest.TestCase): with util.import_state(meta_path=[mock]): mock['pkg'].__all__ = ['module1'] module = import_util.import_('pkg', fromlist=['module2', '*']) - self.assertEquals(module.__name__, 'pkg') + self.assertEqual(module.__name__, 'pkg') self.assertTrue(hasattr(module, 'module1')) self.assertTrue(hasattr(module, 'module2')) - self.assertEquals(module.module1.__name__, 'pkg.module1') - self.assertEquals(module.module2.__name__, 'pkg.module2') + self.assertEqual(module.module1.__name__, 'pkg.module1') + self.assertEqual(module.module2.__name__, 'pkg.module2') def test_main(): diff --git a/Lib/importlib/test/import_/test_meta_path.py b/Lib/importlib/test/import_/test_meta_path.py index 5486694..3b130c9 100644 --- a/Lib/importlib/test/import_/test_meta_path.py +++ b/Lib/importlib/test/import_/test_meta_path.py @@ -21,7 +21,7 @@ class CallingOrder(unittest.TestCase): first.modules[mod] = 42 second.modules[mod] = -13 with util.import_state(meta_path=[first, second]): - self.assertEquals(import_util.import_(mod), 42) + self.assertEqual(import_util.import_(mod), 42) def test_continuing(self): # [continuing] @@ -31,7 +31,7 @@ class CallingOrder(unittest.TestCase): first.find_module = lambda self, fullname, path=None: None second.modules[mod_name] = 42 with util.import_state(meta_path=[first, second]): - self.assertEquals(import_util.import_(mod_name), 42) + self.assertEqual(import_util.import_(mod_name), 42) class CallSignature(unittest.TestCase): @@ -61,9 +61,9 @@ class CallSignature(unittest.TestCase): args = log[0][0] kwargs = log[0][1] # Assuming all arguments are positional. - self.assertEquals(len(args), 2) - self.assertEquals(len(kwargs), 0) - self.assertEquals(args[0], mod_name) + self.assertEqual(len(args), 2) + self.assertEqual(len(kwargs), 0) + self.assertEqual(args[0], mod_name) self.assertTrue(args[1] is None) def test_with_path(self): @@ -83,7 +83,7 @@ class CallSignature(unittest.TestCase): kwargs = log[1][1] # Assuming all arguments are positional. self.assertTrue(not kwargs) - self.assertEquals(args[0], mod_name) + self.assertEqual(args[0], mod_name) self.assertTrue(args[1] is path) |