summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2010-11-20 19:04:17 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2010-11-20 19:04:17 (GMT)
commitb3aedd48621ed9d33b5f42f946b256bce4a50673 (patch)
tree2297c8ebce1b09621e1d98096c1603896d9a0f0c /Lib/importlib
parentb8bc439b2093add9b313bcca2cc507a2d0e87764 (diff)
downloadcpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.zip
cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.gz
cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.bz2
#9424: Replace deprecated assert* methods in the Python test suite.
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/test/import_/test___package__.py4
-rw-r--r--Lib/importlib/test/import_/test_caching.py6
-rw-r--r--Lib/importlib/test/import_/test_fromlist.py24
-rw-r--r--Lib/importlib/test/import_/test_meta_path.py12
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 02679ef..5056ae5 100644
--- a/Lib/importlib/test/import_/test___package__.py
+++ b/Lib/importlib/test/import_/test___package__.py
@@ -42,7 +42,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, package_as_None=False):
# [__name__]
@@ -54,7 +54,7 @@ class Using__package__(unittest.TestCase):
import_util.import_('pkg.fake')
module = import_util.import_('', globals= globals_,
fromlist=['attr'], level=2)
- self.assertEquals(module.__name__, 'pkg')
+ self.assertEqual(module.__name__, 'pkg')
def test_None_as___package__(self):
# [None]
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 14ea5bf..b903e8e 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 basic_star_test(self, fromlist=['*']):
# [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=fromlist)
- self.assertEquals(module.__name__, 'pkg')
+ self.assertEqual(module.__name__, 'pkg')
self.assertTrue(hasattr(module, 'module'))
self.assertEqual(module.module.__name__, 'pkg.module')
@@ -108,11 +108,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)