Skip to content

gh-108303: Remove Lib/test/shadowed_super.py #114372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Lib/test/shadowed_super.py

This file was deleted.

16 changes: 15 additions & 1 deletion Lib/test/test_super.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -342,7 +343,20 @@ def test_super_argtype(self):
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to unload the module explicitly after its usage? Use unload() of import_helper.

import_helper.unload("shadowed_super")

def test_shadowed_local(self):
class super:
Expand Down