summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_parser.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-07-30 11:04:01 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-07-30 11:04:01 (GMT)
commit9211e2fd81fe1db6f73ded70752b144cc9691ab6 (patch)
tree7be7a7109e9e2ca793f8b0a26a7b7c2c350b9479 /Lib/test/test_parser.py
parentf35c51d2eadd297bcf06d4f7c536bd1d8682b724 (diff)
downloadcpython-9211e2fd81fe1db6f73ded70752b144cc9691ab6.zip
cpython-9211e2fd81fe1db6f73ded70752b144cc9691ab6.tar.gz
cpython-9211e2fd81fe1db6f73ded70752b144cc9691ab6.tar.bz2
bpo-37268: Add deprecation notice and a DeprecationWarning for the parser module (GH-15017)
Deprecate the parser module and add a deprecation warning triggered on import and a warning block in the documentation. https://bugs.python.org/issue37268 Automerge-Triggered-By: @pablogsal
Diffstat (limited to 'Lib/test/test_parser.py')
-rw-r--r--Lib/test/test_parser.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
index e5285c6..ec1845d 100644
--- a/Lib/test/test_parser.py
+++ b/Lib/test/test_parser.py
@@ -6,6 +6,7 @@ import operator
import struct
from test import support
from test.support.script_helper import assert_python_failure
+from test.support.script_helper import assert_python_ok
#
# First, we test that we can generate trees from valid source fragments,
@@ -987,5 +988,13 @@ class OtherParserCase(unittest.TestCase):
with self.assertRaises(TypeError):
parser.expr("a", "b")
+
+class TestDeprecation(unittest.TestCase):
+ def test_deprecation_message(self):
+ code = "def f():\n import parser\n\nf()"
+ rc, out, err = assert_python_ok('-c', code)
+ self.assertIn(b'<string>:2: DeprecationWarning', err)
+
+
if __name__ == "__main__":
unittest.main()