diff options
Diffstat (limited to 'Lib/test/test_capi.py')
-rw-r--r-- | Lib/test/test_capi.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index 5e1619b..d512470 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -635,6 +635,14 @@ class CAPITest(unittest.TestCase): s = _testcapi.pyobject_bytes_from_null() self.assertEqual(s, b'<NULL>') + def test_Py_CompileString(self): + # Check that Py_CompileString respects the coding cookie + _compile = _testcapi.Py_CompileString + code = b"# -*- coding: latin1 -*-\nprint('\xc2\xa4')\n" + result = _compile(code) + expected = compile(code, "<string>", "exec") + self.assertEqual(result.co_consts, expected.co_consts) + class TestPendingCalls(unittest.TestCase): @@ -1017,14 +1025,6 @@ class Test_ModuleStateAccess(unittest.TestCase): with self.assertRaises(TypeError): increment_count(1, 2, 3) - def test_Py_CompileString(self): - # Check that Py_CompileString respects the coding cookie - _compile = _testcapi.Py_CompileString - code = b"# -*- coding: latin1 -*-\nprint('\xc2\xa4')\n" - result = _compile(code) - expected = compile(code, "<string>", "exec") - self.assertEqual(result.co_consts, expected.co_consts) - if __name__ == "__main__": unittest.main() |