Use assertIsNone. Thanks Terry Reedy.
This commit is contained in:
parent
591c1cca32
commit
b10951549b
|
@ -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.assertIs(loader, None)
|
||||
self.assertIsNone(loader)
|
||||
|
||||
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.assertIs(loader, None)
|
||||
self.assertIsNone(loader)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -74,12 +74,12 @@ class InspectLoaderTests(unittest.TestCase):
|
|||
def test_get_code(self):
|
||||
# There is no code object.
|
||||
result = machinery.BuiltinImporter.get_code(builtin_util.NAME)
|
||||
self.assertIs(result, None)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_get_source(self):
|
||||
# There is no source.
|
||||
result = machinery.BuiltinImporter.get_source(builtin_util.NAME)
|
||||
self.assertIs(result, None)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_is_package(self):
|
||||
# Cannot be a package.
|
||||
|
|
|
@ -36,7 +36,7 @@ class FinderTests(abc.FinderTests):
|
|||
pass
|
||||
|
||||
def test_failure(self):
|
||||
self.assertIs(self.find_module('asdfjkl;'), None)
|
||||
self.assertIsNone(self.find_module('asdfjkl;'))
|
||||
|
||||
# XXX Raise an exception if someone tries to use the 'path' argument?
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class FinderTests(abc.FinderTests):
|
|||
|
||||
def test_failure(self):
|
||||
loader = self.find('<not real>')
|
||||
self.assertIs(loader, None)
|
||||
self.assertIsNone(loader)
|
||||
|
||||
|
||||
def test_main():
|
||||
|
|
|
@ -93,7 +93,7 @@ class InspectLoaderTests(unittest.TestCase):
|
|||
def test_get_source(self):
|
||||
# Should always return None.
|
||||
result = machinery.FrozenImporter.get_source('__hello__')
|
||||
self.assertIs(result, None)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_is_package(self):
|
||||
# Should be able to tell what is a package.
|
||||
|
|
|
@ -82,7 +82,7 @@ class CallSignature(unittest.TestCase):
|
|||
self.assertEqual(len(args), 2)
|
||||
self.assertEqual(len(kwargs), 0)
|
||||
self.assertEqual(args[0], mod_name)
|
||||
self.assertIs(args[1], None)
|
||||
self.assertIsNone(args[1])
|
||||
|
||||
def test_with_path(self):
|
||||
# [path set]
|
||||
|
|
|
@ -20,7 +20,7 @@ class FinderTests(unittest.TestCase):
|
|||
# Test None returned upon not finding a suitable finder.
|
||||
module = '<test module>'
|
||||
with util.import_state():
|
||||
self.assertIs(machinery.PathFinder.find_module(module), None)
|
||||
self.assertIsNone(machinery.PathFinder.find_module(module))
|
||||
|
||||
def test_sys_path(self):
|
||||
# Test that sys.path is used when 'path' is None.
|
||||
|
|
|
@ -115,7 +115,7 @@ class FinderTests(abc.FinderTests):
|
|||
def test_failure(self):
|
||||
with source_util.create_modules('blah') as mapping:
|
||||
nothing = self.import_(mapping['.root'], 'sdfsadsadf')
|
||||
self.assertIs(nothing, None)
|
||||
self.assertIsNone(nothing)
|
||||
|
||||
def test_empty_string_for_dir(self):
|
||||
# The empty string from sys.path means to search in the cwd.
|
||||
|
|
|
@ -97,7 +97,7 @@ class LifetimeTests(unittest.TestCase):
|
|||
del lock
|
||||
support.gc_collect()
|
||||
self.assertNotIn(name, _bootstrap._module_locks)
|
||||
self.assertIs(wr(), None)
|
||||
self.assertIsNone(wr())
|
||||
|
||||
def test_all_locks(self):
|
||||
support.gc_collect()
|
||||
|
|
Loading…
Reference in New Issue