File tree 2 files changed +15
-8
lines changed
2 files changed +15
-8
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
"""Unit tests for zero-argument super() & related machinery."""
2
2
3
+ import textwrap
3
4
import unittest
4
5
from unittest .mock import patch
5
- from test import shadowed_super
6
+ from test . support import import_helper
6
7
7
8
8
9
ADAPTIVE_WARMUP_DELAY = 2
@@ -342,7 +343,20 @@ def test_super_argtype(self):
342
343
super (1 , int )
343
344
344
345
def test_shadowed_global (self ):
346
+ source = textwrap .dedent (
347
+ """
348
+ class super:
349
+ msg = "truly super"
350
+
351
+ class C:
352
+ def method(self):
353
+ return super().msg
354
+ """ ,
355
+ )
356
+ with import_helper .ready_to_import (name = "shadowed_super" , source = source ):
357
+ import shadowed_super
345
358
self .assertEqual (shadowed_super .C ().method (), "truly super" )
359
+ import_helper .unload ("shadowed_super" )
346
360
347
361
def test_shadowed_local (self ):
348
362
class super :
You can’t perform that action at this time.
0 commit comments