Changeset 391 for python/trunk/Lib/test/test_coding.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/test/test_coding.py
r2 r391 17 17 path = os.path.dirname(__file__) 18 18 filename = os.path.join(path, module_name + '.py') 19 fp = open(filename) 20 text = fp.read() 21 fp.close() 19 with open(filename) as fp: 20 text = fp.read() 22 21 self.assertRaises(SyntaxError, compile, text, filename, 'exec') 22 23 def test_error_from_string(self): 24 # See http://bugs.python.org/issue6289 25 input = u"# coding: ascii\n\N{SNOWMAN}".encode('utf-8') 26 with self.assertRaises(SyntaxError) as c: 27 compile(input, "<string>", "exec") 28 expected = "'ascii' codec can't decode byte 0xe2 in position 16: " \ 29 "ordinal not in range(128)" 30 self.assertTrue(c.exception.args[0].startswith(expected)) 31 23 32 24 33 def test_main():
Note:
See TracChangeset
for help on using the changeset viewer.