@@ -549,6 +549,14 @@ def test_pyobject_bytes_from_null(self):
549
549
s = _testcapi .pyobject_bytes_from_null ()
550
550
self .assertEqual (s , b'<NULL>' )
551
551
552
+ def test_Py_CompileString (self ):
553
+ # Check that Py_CompileString respects the coding cookie
554
+ _compile = _testcapi .Py_CompileString
555
+ code = b"# -*- coding: latin1 -*-\n print('\xc2 \xa4 ')\n "
556
+ result = _compile (code )
557
+ expected = compile (code , "<string>" , "exec" )
558
+ self .assertEqual (result .co_consts , expected .co_consts )
559
+
552
560
553
561
class TestPendingCalls (unittest .TestCase ):
554
562
@@ -926,14 +934,6 @@ def test_state_access(self):
926
934
with self .assertRaises (TypeError ):
927
935
increment_count (1 , 2 , 3 )
928
936
929
- def test_Py_CompileString (self ):
930
- # Check that Py_CompileString respects the coding cookie
931
- _compile = _testcapi .Py_CompileString
932
- code = b"# -*- coding: latin1 -*-\n print('\xc2 \xa4 ')\n "
933
- result = _compile (code )
934
- expected = compile (code , "<string>" , "exec" )
935
- self .assertEqual (result .co_consts , expected .co_consts )
936
-
937
937
938
938
if __name__ == "__main__" :
939
939
unittest .main ()
0 commit comments