Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/test/test_coding.py

    r2 r391  
    1717        path = os.path.dirname(__file__)
    1818        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()
    2221        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
    2332
    2433def test_main():
Note: See TracChangeset for help on using the changeset viewer.