@@ -320,6 +320,10 @@ def test_supported_encodings(self, encoding):
320320 'UTF-8' , 'utf-8' , 'utf-16' , 'utf-16le' , 'utf-16be' ,
321321 'koi8-u' , 'cp1125' , 'cp1251' , 'iso8859-5' , 'mac-cyrillic' ,
322322 ])
323+ @_skip_if_java_pyexpat_backend (
324+ "Java pyexpat backend currently does not support all encodings accepted through CPython's "
325+ "unknown-encoding handler and cannot report UTF-16 XML declarations consistently."
326+ )
323327 def test_supported_encodings2 (self , encoding ):
324328 out = self .Outputter ()
325329 parser = expat .ParserCreate ()
@@ -387,12 +391,20 @@ def test_non_text_encodings(self, encoding):
387391 with self .assertRaises (LookupError ):
388392 parser .Parse (data , True )
389393
394+ @_skip_if_java_pyexpat_backend (
395+ "Java pyexpat backend reports an ExpatError instead of the codec's UnicodeError for an "
396+ "explicitly undefined encoding."
397+ )
390398 def test_undefined_encoding (self ):
391399 parser = expat .ParserCreate ()
392400 data = b'<?xml version="1.0" encoding="undefined"?>\n <root></root>'
393401 with self .assertRaises (UnicodeError ):
394402 parser .Parse (data , True )
395403
404+ @_skip_if_java_pyexpat_backend (
405+ "Java pyexpat backend reports an ExpatError instead of the codec's LookupError for an "
406+ "unknown encoding."
407+ )
396408 def test_unknown_encoding (self ):
397409 parser = expat .ParserCreate ()
398410 data = b'<?xml version="1.0" encoding="xyz"?>\n <root></root>'
@@ -852,6 +864,10 @@ def test_change_size_2(self):
852864 self .assertEqual (self .n , 4 )
853865
854866class ElementDeclHandlerTest (unittest .TestCase ):
867+ @_skip_if_java_pyexpat_backend (
868+ "Java pyexpat backend currently does not enforce Expat's integer return-value contract for "
869+ "NotStandaloneHandler."
870+ )
855871 def test_trigger_leak (self ):
856872 # Unfixed, this test would leak the memory of the so-called
857873 # "content model" in function ``my_ElementDeclHandler`` of pyexpat.
0 commit comments