summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
authorJust van Rossum <just@letterror.com>2003-02-09 20:38:48 (GMT)
committerJust van Rossum <just@letterror.com>2003-02-09 20:38:48 (GMT)
commitf032f86e9e828dfe1147852783aa6784e3ddf610 (patch)
treeef5d3464d068b930514170f5a4b1acdeabd08a13 /Lib/test/test_builtin.py
parentcf117b0b4060a532e13980100c6f94ee98ec2ab1 (diff)
downloadcpython-f032f86e9e828dfe1147852783aa6784e3ddf610.zip
cpython-f032f86e9e828dfe1147852783aa6784e3ddf610.tar.gz
cpython-f032f86e9e828dfe1147852783aa6784e3ddf610.tar.bz2
patch 680474 that fixes bug 679880: compile/eval/exec refused utf-8 bom
mark. Added unit test.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 92e44d5..2e00632 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -190,6 +190,8 @@ class BuiltinTest(unittest.TestCase):
def test_compile(self):
compile('print 1\n', '', 'exec')
+ bom = '\xef\xbb\xbf'
+ compile(bom + 'print 1\n', '', 'exec')
self.assertRaises(TypeError, compile)
self.assertRaises(ValueError, compile, 'print 42\n', '<string>', 'badmode')
self.assertRaises(ValueError, compile, 'print 42\n', '<string>', 'single', 0xff)
@@ -305,6 +307,8 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(eval(unicode('a'), globals, locals), 1)
self.assertEqual(eval(unicode('b'), globals, locals), 200)
self.assertEqual(eval(unicode('c'), globals, locals), 300)
+ bom = '\xef\xbb\xbf'
+ self.assertEqual(eval(bom + 'a', globals, locals), 1)
self.assertRaises(TypeError, eval)
self.assertRaises(TypeError, eval, ())