summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2022-10-05 18:42:26 (GMT)
committerGitHub <noreply@github.com>2022-10-05 18:42:26 (GMT)
commit5dc35991356306055ab2d85b886881ffd6577ae1 (patch)
tree93e10065cca0d56046fca3fdb7c7a68926b9000b /Lib/test
parent815008a3a54a07c8523f9db35492b1750e104900 (diff)
downloadcpython-5dc35991356306055ab2d85b886881ffd6577ae1.zip
cpython-5dc35991356306055ab2d85b886881ffd6577ae1.tar.gz
cpython-5dc35991356306055ab2d85b886881ffd6577ae1.tar.bz2
gh-97850: Remove all known instances of module_repr() (#97876)
Remove all known instances of module_repr()
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_importlib/frozen/test_loader.py9
-rw-r--r--Lib/test/test_importlib/test_abc.py3
-rw-r--r--Lib/test/test_module.py2
3 files changed, 1 insertions, 13 deletions
diff --git a/Lib/test/test_importlib/frozen/test_loader.py b/Lib/test/test_importlib/frozen/test_loader.py
index 32f951c..da1569e 100644
--- a/Lib/test/test_importlib/frozen/test_loader.py
+++ b/Lib/test/test_importlib/frozen/test_loader.py
@@ -103,7 +103,7 @@ class ExecModuleTests(abc.LoaderTests):
expected=value))
self.assertEqual(output, 'Hello world!\n')
- def test_module_repr_indirect(self):
+ def test_module_repr_indirect_through_spec(self):
name = '__hello__'
module, output = self.exec_module(name)
self.assertEqual(repr(module),
@@ -190,13 +190,6 @@ class LoaderTests(abc.LoaderTests):
self.assertEqual(stdout.getvalue(),
'Hello world!\nHello world!\n')
- def test_module_repr(self):
- with fresh('__hello__', oldapi=True):
- module = self.machinery.FrozenImporter.load_module('__hello__')
- repr_str = self.machinery.FrozenImporter.module_repr(module)
- self.assertEqual(repr_str,
- "<module '__hello__' (frozen)>")
-
# No way to trigger an error in a frozen module.
test_state_after_failure = None
diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py
index c214209..8641b6c 100644
--- a/Lib/test/test_importlib/test_abc.py
+++ b/Lib/test/test_importlib/test_abc.py
@@ -687,9 +687,6 @@ class SourceOnlyLoader:
def get_filename(self, fullname):
return self.path
- def module_repr(self, module):
- return '<module>'
-
SPLIT_SOL = make_abc_subclasses(SourceOnlyLoader, 'SourceLoader')
diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py
index 6c83d76..70e4efe 100644
--- a/Lib/test/test_module.py
+++ b/Lib/test/test_module.py
@@ -239,7 +239,6 @@ a = A(destroyed)"""
repr(m), "<module 'foo' (<class 'test.test_module.FullLoader'>)>")
def test_module_repr_with_bare_loader_and_filename(self):
- # Because the loader has no module_repr(), use the file name.
m = ModuleType('foo')
# Yes, a class not an instance.
m.__loader__ = BareLoader
@@ -247,7 +246,6 @@ a = A(destroyed)"""
self.assertEqual(repr(m), "<module 'foo' from '/tmp/foo.py'>")
def test_module_repr_with_full_loader_and_filename(self):
- # Even though the module has an __file__, use __loader__.module_repr()
m = ModuleType('foo')
# Yes, a class not an instance.
m.__loader__ = FullLoader