Skip to content

Commit 8b54982

Browse files
committed
Revert the code since it is in wrong place
1 parent 4752d38 commit 8b54982

File tree

1 file changed

+3
-53
lines changed

1 file changed

+3
-53
lines changed

Lib/idlelib/idle_test/test_warning.py

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,11 @@
55
Revise if output destination changes (http://bugs.python.org/issue18318).
66
Make sure warnings module is left unaltered (http://bugs.python.org/issue18081).
77
'''
8-
import io
9-
import sys
8+
from idlelib import run
9+
from idlelib import pyshell as shell
1010
import unittest
11-
import warnings
12-
from contextlib import redirect_stdout
1311
from test.support import captured_stderr
14-
from types import ModuleType
15-
16-
from idlelib import pyshell as shell
17-
from idlelib import run
18-
12+
import warnings
1913

2014
# Try to capture default showwarning before Idle modules are imported.
2115
showwarning = warnings.showwarning
@@ -75,49 +69,5 @@ def test_shell_show(self):
7569
self.assertEqual(shellmsg.splitlines(), f.getvalue().splitlines())
7670

7771

78-
class TestDeprecatedHelp(unittest.TestCase):
79-
CODE_SIMPLE = r"""
80-
from warnings import deprecated
81-
@deprecated("Test")
82-
class A:
83-
pass
84-
a = A()
85-
"""
86-
CODE_SUBCLASS = r"""
87-
from warnings import deprecated
88-
@deprecated("Test")
89-
class A:
90-
def __init_subclass__(self, **kwargs):
91-
pass
92-
class B(A):
93-
pass
94-
b = B()
95-
"""
96-
def setUp(self):
97-
self.module = ModuleType("testmodule")
98-
99-
def tearDown(self):
100-
if "testmodule" in sys.modules:
101-
del sys.modules["testmodule"]
102-
103-
def _get_help_output(self, code):
104-
with self.assertWarns(DeprecationWarning) as cm:
105-
exec(code, self.module.__dict__)
106-
sys.modules["testmodule"] = self.module
107-
108-
f = io.StringIO()
109-
with redirect_stdout(f):
110-
help(self.module)
111-
112-
self.assertEqual(str(cm.warning), "Test")
113-
return f.getvalue()
114-
115-
def test_help_output(self):
116-
for code in (self.CODE_SIMPLE, self.CODE_SUBCLASS):
117-
with self.subTest(code=code):
118-
help_output = self._get_help_output(code)
119-
self.assertIn("Help on module testmodule:", help_output)
120-
121-
12272
if __name__ == '__main__':
12373
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)