mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
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. ........
This commit is contained in:
parent
b65b4937e2
commit
19f2aeba67
164 changed files with 2281 additions and 2279 deletions
|
|
@ -41,7 +41,7 @@ def test_using___package__(self):
|
|||
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 @@ def test_using___name__(self):
|
|||
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>'}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ def test_using_cache_after_loader(self):
|
|||
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 @@ def test_using_cache_for_fromlist(self):
|
|||
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():
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@ def test_return_from_import(self):
|
|||
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 @@ def test_object(self):
|
|||
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 @@ def test_module_from_package(self):
|
|||
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 @@ def test_using_star(self):
|
|||
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 @@ def test_star_with_others(self):
|
|||
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():
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ def test_first_called(self):
|
|||
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 @@ def test_continuing(self):
|
|||
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 @@ def test_no_path(self):
|
|||
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 @@ def test_with_path(self):
|
|||
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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue