mirror of
https://github.com/python/cpython.git
synced 2025-09-29 03:35:31 +00:00
[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 2ef520ebec
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
1bd2c93474
commit
954bbcc1b9
2 changed files with 15 additions and 8 deletions
|
@ -1,7 +0,0 @@
|
||||||
class super:
|
|
||||||
msg = "truly super"
|
|
||||||
|
|
||||||
|
|
||||||
class C:
|
|
||||||
def method(self):
|
|
||||||
return super().msg
|
|
|
@ -1,8 +1,9 @@
|
||||||
"""Unit tests for zero-argument super() & related machinery."""
|
"""Unit tests for zero-argument super() & related machinery."""
|
||||||
|
|
||||||
|
import textwrap
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
from test import shadowed_super
|
from test.support import import_helper
|
||||||
|
|
||||||
|
|
||||||
ADAPTIVE_WARMUP_DELAY = 2
|
ADAPTIVE_WARMUP_DELAY = 2
|
||||||
|
@ -342,7 +343,20 @@ class TestSuper(unittest.TestCase):
|
||||||
super(1, int)
|
super(1, int)
|
||||||
|
|
||||||
def test_shadowed_global(self):
|
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")
|
self.assertEqual(shadowed_super.C().method(), "truly super")
|
||||||
|
import_helper.unload("shadowed_super")
|
||||||
|
|
||||||
def test_shadowed_local(self):
|
def test_shadowed_local(self):
|
||||||
class super:
|
class super:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue