summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-01-22 15:40:42 (GMT)
committerGitHub <noreply@github.com>2024-01-22 15:40:42 (GMT)
commit954bbcc1b9daed3169719f6ca66302f164e362e1 (patch)
treeda22df6be060f5c8b7a4de776038017927a94afc /Lib
parent1bd2c93474792dae99664a43cfb70120a809c05d (diff)
downloadcpython-954bbcc1b9daed3169719f6ca66302f164e362e1.zip
cpython-954bbcc1b9daed3169719f6ca66302f164e362e1.tar.gz
cpython-954bbcc1b9daed3169719f6ca66302f164e362e1.tar.bz2
[3.12] gh-108303: Remove `Lib/test/shadowed_super.py` (GH-114372) (#114433)
gh-108303: Remove `Lib/test/shadowed_super.py` (GH-114372) Move code into Lib/test/test_super.py. (cherry picked from commit 2ef520ebecf5544ba792266a5dbe4d53653a4a03) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/shadowed_super.py7
-rw-r--r--Lib/test/test_super.py16
2 files changed, 15 insertions, 8 deletions
diff --git a/Lib/test/shadowed_super.py b/Lib/test/shadowed_super.py
deleted file mode 100644
index 2a62f66..0000000
--- a/Lib/test/shadowed_super.py
+++ /dev/null
@@ -1,7 +0,0 @@
-class super:
- msg = "truly super"
-
-
-class C:
- def method(self):
- return super().msg
diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py
index 43162c5..3ea0141 100644
--- a/Lib/test/test_super.py
+++ b/Lib/test/test_super.py
@@ -1,8 +1,9 @@
"""Unit tests for zero-argument super() & related machinery."""
+import textwrap
import unittest
from unittest.mock import patch
-from test import shadowed_super
+from test.support import import_helper
ADAPTIVE_WARMUP_DELAY = 2
@@ -342,7 +343,20 @@ class TestSuper(unittest.TestCase):
super(1, int)
def test_shadowed_global(self):
+ source = textwrap.dedent(
+ """
+ class super:
+ msg = "truly super"
+
+ class C:
+ def method(self):
+ return super().msg
+ """,
+ )
+ with import_helper.ready_to_import(name="shadowed_super", source=source):
+ import shadowed_super
self.assertEqual(shadowed_super.C().method(), "truly super")
+ import_helper.unload("shadowed_super")
def test_shadowed_local(self):
class super: