mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
Merge with 3.4
This commit is contained in:
commit
52ee2471b3
@ -68,6 +68,15 @@ class ShellWarnTest(unittest.TestCase):
|
||||
'Test', UserWarning, 'test_warning.py', 99, f, 'Line of code')
|
||||
self.assertEqual(shellmsg.splitlines(), f.getvalue().splitlines())
|
||||
|
||||
class ImportWarnTest(unittest.TestCase):
|
||||
def test_idlever(self):
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
import idlelib.idlever
|
||||
self.assertEqual(len(w), 1)
|
||||
self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
|
||||
self.assertIn("version", str(w[-1].message))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2, exit=False)
|
||||
|
@ -1,4 +1,12 @@
|
||||
"""Unused by Idle: there is no separate Idle version anymore.
|
||||
Kept only for possible existing extension use."""
|
||||
"""
|
||||
The separate Idle version was eliminated years ago;
|
||||
idlelib.idlever is no longer used by Idle
|
||||
and will be removed in 3.6 or later. Use
|
||||
from sys import version
|
||||
IDLE_VERSION = version[:version.index(' ')]
|
||||
"""
|
||||
# Kept for now only for possible existing extension use
|
||||
import warnings as w
|
||||
w.warn(__doc__, DeprecationWarning)
|
||||
from sys import version
|
||||
IDLE_VERSION = version[:version.index(' ')]
|
||||
|
Loading…
Reference in New Issue
Block a user