summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorDino Viehland <dinoviehland@gmail.com>2019-05-28 23:21:17 (GMT)
committerGitHub <noreply@github.com>2019-05-28 23:21:17 (GMT)
commit415406999d7c09af9f3dcacfb4578b9e97b2ce77 (patch)
tree99aba9596d3532bb75913ac7c1c8dda8aebd9f91 /Lib/test
parentab0716ed1ea2957396054730afbb80c1825f9786 (diff)
downloadcpython-415406999d7c09af9f3dcacfb4578b9e97b2ce77.zip
cpython-415406999d7c09af9f3dcacfb4578b9e97b2ce77.tar.gz
cpython-415406999d7c09af9f3dcacfb4578b9e97b2ce77.tar.bz2
bpo-37001: Makes symtable.symtable have parity with compile for input (#13483)
* Makes symtable.symtable have parity for accepted datatypes for source code as compile() * Add NEWS blurb
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_symtable.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py
index 0a1cb8d..bea2ce1 100644
--- a/Lib/test/test_symtable.py
+++ b/Lib/test/test_symtable.py
@@ -215,6 +215,15 @@ class SymtableTest(unittest.TestCase):
def test_exec(self):
symbols = symtable.symtable("def f(x): return x", "?", "exec")
+ def test_bytes(self):
+ top = symtable.symtable(TEST_CODE.encode('utf8'), "?", "exec")
+ self.assertIsNotNone(find_block(top, "Mine"))
+
+ code = b'# -*- coding: iso8859-15 -*-\nclass \xb4: pass\n'
+
+ top = symtable.symtable(code, "?", "exec")
+ self.assertIsNotNone(find_block(top, "\u017d"))
+
if __name__ == '__main__':
unittest.main()