mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
convert old fail* assertions to assert*
This commit is contained in:
parent
98d23f2e06
commit
c9c0f201fe
275 changed files with 4540 additions and 4540 deletions
|
@ -14,7 +14,7 @@ class FinderTests(abc.FinderTests):
|
|||
# Common case.
|
||||
with util.uncache(builtin_util.NAME):
|
||||
found = machinery.BuiltinImporter.find_module(builtin_util.NAME)
|
||||
self.assert_(found)
|
||||
self.assertTrue(found)
|
||||
|
||||
def test_package(self):
|
||||
# Built-in modules cannot be a package.
|
||||
|
@ -35,14 +35,14 @@ class FinderTests(abc.FinderTests):
|
|||
def test_failure(self):
|
||||
assert 'importlib' not in sys.builtin_module_names
|
||||
loader = machinery.BuiltinImporter.find_module('importlib')
|
||||
self.assert_(loader is None)
|
||||
self.assertTrue(loader is None)
|
||||
|
||||
def test_ignore_path(self):
|
||||
# The value for 'path' should always trigger a failed import.
|
||||
with util.uncache(builtin_util.NAME):
|
||||
loader = machinery.BuiltinImporter.find_module(builtin_util.NAME,
|
||||
['pkg'])
|
||||
self.assert_(loader is None)
|
||||
self.assertTrue(loader is None)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ class LoaderTests(abc.LoaderTests):
|
|||
|
||||
def verify(self, module):
|
||||
"""Verify that the module matches against what it should have."""
|
||||
self.assert_(isinstance(module, types.ModuleType))
|
||||
self.assertTrue(isinstance(module, types.ModuleType))
|
||||
for attr, value in self.verification.items():
|
||||
self.assertEqual(getattr(module, attr), value)
|
||||
self.assert_(module.__name__ in sys.modules)
|
||||
self.assertTrue(module.__name__ in sys.modules)
|
||||
|
||||
load_module = staticmethod(lambda name:
|
||||
machinery.BuiltinImporter.load_module(name))
|
||||
|
@ -49,7 +49,7 @@ class LoaderTests(abc.LoaderTests):
|
|||
with util.uncache(builtin_util.NAME):
|
||||
module1 = self.load_module(builtin_util.NAME)
|
||||
module2 = self.load_module(builtin_util.NAME)
|
||||
self.assert_(module1 is module2)
|
||||
self.assertTrue(module1 is module2)
|
||||
|
||||
def test_unloadable(self):
|
||||
name = 'dssdsdfff'
|
||||
|
@ -70,17 +70,17 @@ class InspectLoaderTests(unittest.TestCase):
|
|||
def test_get_code(self):
|
||||
# There is no code object.
|
||||
result = machinery.BuiltinImporter.get_code(builtin_util.NAME)
|
||||
self.assert_(result is None)
|
||||
self.assertTrue(result is None)
|
||||
|
||||
def test_get_source(self):
|
||||
# There is no source.
|
||||
result = machinery.BuiltinImporter.get_source(builtin_util.NAME)
|
||||
self.assert_(result is None)
|
||||
self.assertTrue(result is None)
|
||||
|
||||
def test_is_package(self):
|
||||
# Cannot be a package.
|
||||
result = machinery.BuiltinImporter.is_package(builtin_util.NAME)
|
||||
self.assert_(not result)
|
||||
self.assertTrue(not result)
|
||||
|
||||
def test_not_builtin(self):
|
||||
# Modules not built-in should raise ImportError.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue