summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-22 20:53:01 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-22 20:53:01 (GMT)
commitaf59346f1ac1d1acf0d17b789d0e69f6d95d6e38 (patch)
tree973c0c070d66f8cd33611be77824a292a88c2934 /Lib/test/test_builtin.py
parent24eac034be17067f4df3a277ae42e30af138441a (diff)
downloadcpython-af59346f1ac1d1acf0d17b789d0e69f6d95d6e38.zip
cpython-af59346f1ac1d1acf0d17b789d0e69f6d95d6e38.tar.gz
cpython-af59346f1ac1d1acf0d17b789d0e69f6d95d6e38.tar.bz2
Problem found while converting from PyBytes to PyString:
Re-enable (and correct) a test for the BOM at the beginning of a code unit. And properly "unget" characters when the BOM is incomplete.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 4f84328..d543751 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -200,8 +200,8 @@ class BuiltinTest(unittest.TestCase):
def test_compile(self):
compile('print(1)\n', '', 'exec')
-## bom = b'\xef\xbb\xbf'
-## compile(bom + b'print(1)\n', '', 'exec')
+ bom = b'\xef\xbb\xbf'
+ compile(bom + b'print(1)\n', '', 'exec')
compile(source='pass', filename='?', mode='exec')
compile(dont_inherit=0, filename='tmp', source='0', mode='eval')
compile('pass', '?', dont_inherit=1, mode='exec')
@@ -327,11 +327,12 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(eval('c', globals, locals), 300)
globals = {'a': 1, 'b': 2}
locals = {'b': 200, 'c': 300}
-## bom = b'\xef\xbb\xbf'
-## self.assertEqual(eval(bom + b'a', globals, locals), 1)
+ bom = b'\xef\xbb\xbf'
+ self.assertEqual(eval(bom + b'a', globals, locals), 1)
self.assertEqual(eval('"\xe5"', globals), "\xe5")
self.assertRaises(TypeError, eval)
self.assertRaises(TypeError, eval, ())
+ self.assertRaises(SyntaxError, eval, bom[:2] + b'a')
def test_general_eval(self):
# Tests that general mappings can be used for the locals argument