Skip to content

Commit ec90a22

Browse files
committed
pyexpat: mark tests as expected failure
1 parent d382009 commit ec90a22

1 file changed

Lines changed: 83 additions & 1 deletion

File tree

Lib/test/test_pyexpat.py

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,40 @@ class SetAttributeTest(unittest.TestCase):
1919
def setUp(self):
2020
self.parser = expat.ParserCreate(namespace_separator='!')
2121

22+
# TODO: RUSTPYTHON
23+
@unittest.expectedFailure
2224
def test_buffer_text(self):
2325
self.assertIs(self.parser.buffer_text, False)
2426
for x in 0, 1, 2, 0:
2527
self.parser.buffer_text = x
2628
self.assertIs(self.parser.buffer_text, bool(x))
2729

30+
# TODO: RUSTPYTHON
31+
@unittest.expectedFailure
2832
def test_namespace_prefixes(self):
2933
self.assertIs(self.parser.namespace_prefixes, False)
3034
for x in 0, 1, 2, 0:
3135
self.parser.namespace_prefixes = x
3236
self.assertIs(self.parser.namespace_prefixes, bool(x))
3337

38+
# TODO: RUSTPYTHON
39+
@unittest.expectedFailure
3440
def test_ordered_attributes(self):
3541
self.assertIs(self.parser.ordered_attributes, False)
3642
for x in 0, 1, 2, 0:
3743
self.parser.ordered_attributes = x
3844
self.assertIs(self.parser.ordered_attributes, bool(x))
3945

46+
# TODO: RUSTPYTHON
47+
@unittest.expectedFailure
4048
def test_specified_attributes(self):
4149
self.assertIs(self.parser.specified_attributes, False)
4250
for x in 0, 1, 2, 0:
4351
self.parser.specified_attributes = x
4452
self.assertIs(self.parser.specified_attributes, bool(x))
4553

54+
# TODO: RUSTPYTHON
55+
@unittest.expectedFailure
4656
def test_invalid_attributes(self):
4757
with self.assertRaises(AttributeError):
4858
self.parser.returns_unicode = 1
@@ -226,6 +236,8 @@ def _verify_parse_output(self, operations):
226236
for operation, expected_operation in zip(operations, expected_operations):
227237
self.assertEqual(operation, expected_operation)
228238

239+
# TODO: RUSTPYTHON
240+
@unittest.expectedFailure
229241
def test_parse_bytes(self):
230242
out = self.Outputter()
231243
parser = expat.ParserCreate(namespace_separator='!')
@@ -238,6 +250,8 @@ def test_parse_bytes(self):
238250
# Issue #6697.
239251
self.assertRaises(AttributeError, getattr, parser, '\uD800')
240252

253+
# TODO: RUSTPYTHON
254+
@unittest.expectedFailure
241255
def test_parse_str(self):
242256
out = self.Outputter()
243257
parser = expat.ParserCreate(namespace_separator='!')
@@ -248,6 +262,8 @@ def test_parse_str(self):
248262
operations = out.out
249263
self._verify_parse_output(operations)
250264

265+
# TODO: RUSTPYTHON
266+
@unittest.expectedFailure
251267
def test_parse_file(self):
252268
# Try parsing a file
253269
out = self.Outputter()
@@ -260,6 +276,8 @@ def test_parse_file(self):
260276
operations = out.out
261277
self._verify_parse_output(operations)
262278

279+
# TODO: RUSTPYTHON
280+
@unittest.expectedFailure
263281
def test_parse_again(self):
264282
parser = expat.ParserCreate()
265283
file = BytesIO(data)
@@ -273,13 +291,17 @@ def test_parse_again(self):
273291
expat.errors.XML_ERROR_FINISHED)
274292

275293
class NamespaceSeparatorTest(unittest.TestCase):
294+
# TODO: RUSTPYTHON
295+
@unittest.expectedFailure
276296
def test_legal(self):
277297
# Tests that make sure we get errors when the namespace_separator value
278298
# is illegal, and that we don't for good values:
279299
expat.ParserCreate()
280300
expat.ParserCreate(namespace_separator=None)
281301
expat.ParserCreate(namespace_separator=' ')
282302

303+
# TODO: RUSTPYTHON
304+
@unittest.expectedFailure
283305
def test_illegal(self):
284306
try:
285307
expat.ParserCreate(namespace_separator=42)
@@ -295,6 +317,8 @@ def test_illegal(self):
295317
self.assertEqual(str(e),
296318
'namespace_separator must be at most one character, omitted, or None')
297319

320+
# TODO: RUSTPYTHON
321+
@unittest.expectedFailure
298322
def test_zero_length(self):
299323
# ParserCreate() needs to accept a namespace_separator of zero length
300324
# to satisfy the requirements of RDF applications that are required
@@ -308,6 +332,9 @@ def test_zero_length(self):
308332

309333

310334
class InterningTest(unittest.TestCase):
335+
336+
# TODO: RUSTPYTHON
337+
@unittest.expectedFailure
311338
def test(self):
312339
# Test the interning machinery.
313340
p = expat.ParserCreate()
@@ -323,6 +350,8 @@ def collector(name, *args):
323350
# L should have the same string repeated over and over.
324351
self.assertTrue(tag is entry)
325352

353+
# TODO: RUSTPYTHON
354+
@unittest.expectedFailure
326355
def test_issue9402(self):
327356
# create an ExternalEntityParserCreate with buffer text
328357
class ExternalOutputter:
@@ -376,17 +405,23 @@ def setHandlers(self, handlers=[]):
376405
for name in handlers:
377406
setattr(self.parser, name, getattr(self, name))
378407

408+
# TODO: RUSTPYTHON
409+
@unittest.expectedFailure
379410
def test_default_to_disabled(self):
380411
parser = expat.ParserCreate()
381412
self.assertFalse(parser.buffer_text)
382413

414+
# TODO: RUSTPYTHON
415+
@unittest.expectedFailure
383416
def test_buffering_enabled(self):
384417
# Make sure buffering is turned on
385418
self.assertTrue(self.parser.buffer_text)
386419
self.parser.Parse(b"<a>1<b/>2<c/>3</a>", True)
387420
self.assertEqual(self.stuff, ['123'],
388421
"buffered text not properly collapsed")
389422

423+
# TODO: RUSTPYTHON
424+
@unittest.expectedFailure
390425
def test1(self):
391426
# XXX This test exposes more detail of Expat's text chunking than we
392427
# XXX like, but it tests what we need to concisely.
@@ -396,30 +431,40 @@ def test1(self):
396431
["<a>", "1", "<b>", "2", "\n", "3", "<c>", "4\n5"],
397432
"buffering control not reacting as expected")
398433

434+
# TODO: RUSTPYTHON
435+
@unittest.expectedFailure
399436
def test2(self):
400437
self.parser.Parse(b"<a>1<b/>&lt;2&gt;<c/>&#32;\n&#x20;3</a>", True)
401438
self.assertEqual(self.stuff, ["1<2> \n 3"],
402439
"buffered text not properly collapsed")
403440

441+
# TODO: RUSTPYTHON
442+
@unittest.expectedFailure
404443
def test3(self):
405444
self.setHandlers(["StartElementHandler"])
406445
self.parser.Parse(b"<a>1<b/>2<c/>3</a>", True)
407446
self.assertEqual(self.stuff, ["<a>", "1", "<b>", "2", "<c>", "3"],
408447
"buffered text not properly split")
409448

449+
# TODO: RUSTPYTHON
450+
@unittest.expectedFailure
410451
def test4(self):
411452
self.setHandlers(["StartElementHandler", "EndElementHandler"])
412453
self.parser.CharacterDataHandler = None
413454
self.parser.Parse(b"<a>1<b/>2<c/>3</a>", True)
414455
self.assertEqual(self.stuff,
415456
["<a>", "<b>", "</b>", "<c>", "</c>", "</a>"])
416457

458+
# TODO: RUSTPYTHON
459+
@unittest.expectedFailure
417460
def test5(self):
418461
self.setHandlers(["StartElementHandler", "EndElementHandler"])
419462
self.parser.Parse(b"<a>1<b></b>2<c/>3</a>", True)
420463
self.assertEqual(self.stuff,
421464
["<a>", "1", "<b>", "</b>", "2", "<c>", "</c>", "3", "</a>"])
422465

466+
# TODO: RUSTPYTHON
467+
@unittest.expectedFailure
423468
def test6(self):
424469
self.setHandlers(["CommentHandler", "EndElementHandler",
425470
"StartElementHandler"])
@@ -428,6 +473,8 @@ def test6(self):
428473
["<a>", "1", "<b>", "</b>", "2", "<c>", "</c>", "345", "</a>"],
429474
"buffered text not properly split")
430475

476+
# TODO: RUSTPYTHON
477+
@unittest.expectedFailure
431478
def test7(self):
432479
self.setHandlers(["CommentHandler", "EndElementHandler",
433480
"StartElementHandler"])
@@ -447,6 +494,8 @@ def check_traceback_entry(self, entry, filename, funcname):
447494
self.assertEqual(os.path.basename(entry[0]), filename)
448495
self.assertEqual(entry[2], funcname)
449496

497+
# TODO: RUSTPYTHON
498+
@unittest.expectedFailure
450499
def test_exception(self):
451500
parser = expat.ParserCreate()
452501
parser.StartElementHandler = self.StartElementHandler
@@ -490,6 +539,8 @@ def check_pos(self, event):
490539
'Expected position %s, got position %s' %(pos, expected))
491540
self.upto += 1
492541

542+
# TODO: RUSTPYTHON
543+
@unittest.expectedFailure
493544
def test(self):
494545
self.parser = expat.ParserCreate()
495546
self.parser.StartElementHandler = self.StartElementHandler
@@ -503,6 +554,9 @@ def test(self):
503554

504555

505556
class sf1296433Test(unittest.TestCase):
557+
558+
# TODO: RUSTPYTHON
559+
@unittest.expectedFailure
506560
def test_parse_only_xml_data(self):
507561
# http://python.org/sf/1296433
508562
#
@@ -526,12 +580,18 @@ class ChardataBufferTest(unittest.TestCase):
526580
test setting of chardata buffer size
527581
"""
528582

583+
# TODO: RUSTPYTHON
584+
@unittest.expectedFailure
529585
def test_1025_bytes(self):
530586
self.assertEqual(self.small_buffer_test(1025), 2)
531587

588+
# TODO: RUSTPYTHON
589+
@unittest.expectedFailure
532590
def test_1000_bytes(self):
533591
self.assertEqual(self.small_buffer_test(1000), 1)
534592

593+
# TODO: RUSTPYTHON
594+
@unittest.expectedFailure
535595
def test_wrong_size(self):
536596
parser = expat.ParserCreate()
537597
parser.buffer_text = 1
@@ -544,6 +604,8 @@ def test_wrong_size(self):
544604
with self.assertRaises(TypeError):
545605
parser.buffer_size = 512.0
546606

607+
# TODO: RUSTPYTHON
608+
@unittest.expectedFailure
547609
def test_unchanged_size(self):
548610
xml1 = b"<?xml version='1.0' encoding='iso8859'?><s>" + b'a' * 512
549611
xml2 = b'a'*512 + b'</s>'
@@ -566,7 +628,8 @@ def test_unchanged_size(self):
566628
parser.Parse(xml2)
567629
self.assertEqual(self.n, 2)
568630

569-
631+
# TODO: RUSTPYTHON
632+
@unittest.expectedFailure
570633
def test_disabling_buffer(self):
571634
xml1 = b"<?xml version='1.0' encoding='iso8859'?><a>" + b'a' * 512
572635
xml2 = b'b' * 1024
@@ -611,6 +674,8 @@ def small_buffer_test(self, buffer_len):
611674
parser.Parse(xml)
612675
return self.n
613676

677+
# TODO: RUSTPYTHON
678+
@unittest.expectedFailure
614679
def test_change_size_1(self):
615680
xml1 = b"<?xml version='1.0' encoding='iso8859'?><a><s>" + b'a' * 1024
616681
xml2 = b'aaa</s><s>' + b'a' * 1025 + b'</s></a>'
@@ -627,6 +692,8 @@ def test_change_size_1(self):
627692
parser.Parse(xml2, True)
628693
self.assertEqual(self.n, 2)
629694

695+
# TODO: RUSTPYTHON
696+
@unittest.expectedFailure
630697
def test_change_size_2(self):
631698
xml1 = b"<?xml version='1.0' encoding='iso8859'?><a>a<s>" + b'a' * 1023
632699
xml2 = b'aaa</s><s>' + b'a' * 1025 + b'</s></a>'
@@ -644,6 +711,9 @@ def test_change_size_2(self):
644711
self.assertEqual(self.n, 4)
645712

646713
class MalformedInputTest(unittest.TestCase):
714+
715+
# TODO: RUSTPYTHON
716+
@unittest.expectedFailure
647717
def test1(self):
648718
xml = b"\0\r\n"
649719
parser = expat.ParserCreate()
@@ -653,6 +723,8 @@ def test1(self):
653723
except expat.ExpatError as e:
654724
self.assertEqual(str(e), 'unclosed token: line 2, column 0')
655725

726+
# TODO: RUSTPYTHON
727+
@unittest.expectedFailure
656728
def test2(self):
657729
# \xc2\x85 is UTF-8 encoded U+0085 (NEXT LINE)
658730
xml = b"<?xml version\xc2\x85='1.0'?>\r\n"
@@ -662,11 +734,16 @@ def test2(self):
662734
parser.Parse(xml, True)
663735

664736
class ErrorMessageTest(unittest.TestCase):
737+
738+
# TODO: RUSTPYTHON
739+
@unittest.expectedFailure
665740
def test_codes(self):
666741
# verify mapping of errors.codes and errors.messages
667742
self.assertEqual(errors.XML_ERROR_SYNTAX,
668743
errors.messages[errors.codes[errors.XML_ERROR_SYNTAX]])
669744

745+
# TODO: RUSTPYTHON
746+
@unittest.expectedFailure
670747
def test_expaterror(self):
671748
xml = b'<'
672749
parser = expat.ParserCreate()
@@ -682,6 +759,9 @@ class ForeignDTDTests(unittest.TestCase):
682759
"""
683760
Tests for the UseForeignDTD method of expat parser objects.
684761
"""
762+
763+
# TODO: RUSTPYTHON
764+
@unittest.expectedFailure
685765
def test_use_foreign_dtd(self):
686766
"""
687767
If UseForeignDTD is passed True and a document without an external
@@ -710,6 +790,8 @@ def resolve_entity(context, base, system_id, public_id):
710790
parser.Parse(b"<?xml version='1.0'?><element/>")
711791
self.assertEqual(handler_call_args, [(None, None)])
712792

793+
# TODO: RUSTPYTHON
794+
@unittest.expectedFailure
713795
def test_ignore_use_foreign_dtd(self):
714796
"""
715797
If UseForeignDTD is passed True and a document with an external

0 commit comments

Comments
 (0)