Skip to content

Commit afea165

Browse files
committed
Fix test_io expectedFailures
1 parent c0af6eb commit afea165

File tree

18 files changed

+983
-526
lines changed

18 files changed

+983
-526
lines changed

Lib/_pycodecs.py

Lines changed: 350 additions & 232 deletions
Large diffs are not rendered by default.

Lib/test/test_bz2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def testOpenBytesFilename(self):
730730
self.assertEqual(f.read(), self.DATA)
731731
self.assertEqual(f.name, str_filename)
732732

733-
@unittest.expectedFailure # TODO: RUSTPYTHON
733+
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: <FakePath 'Z:\\TEMP\\tmphoipjcen'> != 'Z:\\TEMP\\tmphoipjcen'
734734
def testOpenPathLikeFilename(self):
735735
filename = FakePath(self.filename)
736736
with BZ2File(filename, "wb") as f:
@@ -1189,7 +1189,6 @@ def test_encoding_error_handler(self):
11891189
as f:
11901190
self.assertEqual(f.read(), "foobar")
11911191

1192-
@unittest.expectedFailure # TODO: RUSTPYTHON
11931192
def test_newline(self):
11941193
# Test with explicit newline (universal newline mode disabled).
11951194
text = self.TEXT.decode("ascii")

Lib/test/test_codecs.py

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ class UTF32Test(ReadTest, unittest.TestCase):
465465
b'\x00\x00\x00s\x00\x00\x00p\x00\x00\x00a\x00\x00\x00m'
466466
b'\x00\x00\x00s\x00\x00\x00p\x00\x00\x00a\x00\x00\x00m')
467467

468-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
469468
def test_only_one_bom(self):
470469
_,_,reader,writer = codecs.lookup(self.encoding)
471470
# encode some stream
@@ -481,7 +480,6 @@ def test_only_one_bom(self):
481480
f = reader(s)
482481
self.assertEqual(f.read(), "spamspam")
483482

484-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
485483
def test_badbom(self):
486484
s = io.BytesIO(4*b"\xff")
487485
f = codecs.getreader(self.encoding)(s)
@@ -491,7 +489,6 @@ def test_badbom(self):
491489
f = codecs.getreader(self.encoding)(s)
492490
self.assertRaises(UnicodeDecodeError, f.read)
493491

494-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
495492
def test_partial(self):
496493
self.check_partial(
497494
"\x00\xff\u0100\uffff\U00010000",
@@ -523,7 +520,6 @@ def test_partial(self):
523520
]
524521
)
525522

526-
@unittest.expectedFailure # TODO: RUSTPYTHON
527523
def test_handlers(self):
528524
self.assertEqual(('\ufffd', 1),
529525
codecs.utf_32_decode(b'\x01', 'replace', True))
@@ -534,7 +530,6 @@ def test_errors(self):
534530
self.assertRaises(UnicodeDecodeError, codecs.utf_32_decode,
535531
b"\xff", "strict", True)
536532

537-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
538533
def test_decoder_state(self):
539534
self.check_state_handling_decode(self.encoding,
540535
"spamspam", self.spamle)
@@ -551,35 +546,24 @@ def test_issue8941(self):
551546
self.assertEqual('\U00010000' * 1024,
552547
codecs.utf_32_decode(encoded_be)[0])
553548

554-
@unittest.expectedFailure # TODO: RUSTPYTHON
555-
def test_lone_surrogates(self):
556-
return super().test_lone_surrogates()
557-
558-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
559549
def test_bug1098990_a(self):
560550
return super().test_bug1098990_a()
561551

562-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
563552
def test_bug1098990_b(self):
564553
return super().test_bug1098990_b()
565554

566-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
567555
def test_bug1175396(self):
568556
return super().test_bug1175396()
569557

570-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
571558
def test_incremental_surrogatepass(self):
572559
return super().test_incremental_surrogatepass()
573560

574-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
575561
def test_mixed_readline_and_read(self):
576562
return super().test_mixed_readline_and_read()
577563

578-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
579564
def test_readline(self):
580565
return super().test_readline()
581566

582-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
583567
def test_readlinequeue(self):
584568
return super().test_readlinequeue()
585569

@@ -636,10 +620,6 @@ def test_issue8941(self):
636620
self.assertEqual('\U00010000' * 1024,
637621
codecs.utf_32_le_decode(encoded)[0])
638622

639-
@unittest.expectedFailure # TODO: RUSTPYTHON
640-
def test_lone_surrogates(self):
641-
return super().test_lone_surrogates()
642-
643623

644624

645625

@@ -693,10 +673,6 @@ def test_issue8941(self):
693673
self.assertEqual('\U00010000' * 1024,
694674
codecs.utf_32_be_decode(encoded)[0])
695675

696-
@unittest.expectedFailure # TODO: RUSTPYTHON
697-
def test_lone_surrogates(self):
698-
return super().test_lone_surrogates()
699-
700676

701677

702678

@@ -739,7 +715,6 @@ def test_badbom(self):
739715
f = codecs.getreader(self.encoding)(s)
740716
self.assertRaises(UnicodeDecodeError, f.read)
741717

742-
@unittest.expectedFailure # TODO: RUSTPYTHON; UnicodeDecodeError: 'utf-16' codec can't decode bytes in position 0-1: unexpected end of data
743718
def test_partial(self):
744719
self.check_partial(
745720
"\x00\xff\u0100\uffff\U00010000",
@@ -761,7 +736,6 @@ def test_partial(self):
761736
]
762737
)
763738

764-
@unittest.expectedFailure # TODO: RUSTPYTHON; IndexError: index out of range
765739
def test_handlers(self):
766740
self.assertEqual(('\ufffd', 1),
767741
codecs.utf_16_decode(b'\x01', 'replace', True))
@@ -805,11 +779,6 @@ def test_invalid_modes(self):
805779
self.assertIn("can't have text and binary mode at once",
806780
str(cm.exception))
807781

808-
@unittest.expectedFailure # TODO: RUSTPYTHON
809-
def test_lone_surrogates(self):
810-
return super().test_lone_surrogates()
811-
812-
@unittest.expectedFailure # TODO: RUSTPYTHON; IndexError: index out of range
813782
def test_incremental_surrogatepass(self):
814783
return super().test_incremental_surrogatepass()
815784

@@ -819,7 +788,6 @@ class UTF16LETest(ReadTest, unittest.TestCase):
819788
encoding = "utf-16-le"
820789
ill_formed_sequence = b"\x80\xdc"
821790

822-
@unittest.expectedFailure # TODO: RUSTPYTHON; UnicodeDecodeError: 'utf-16' codec can't decode bytes in position 0-1: unexpected end of data
823791
def test_partial(self):
824792
self.check_partial(
825793
"\x00\xff\u0100\uffff\U00010000",
@@ -839,7 +807,6 @@ def test_partial(self):
839807
]
840808
)
841809

842-
@unittest.expectedFailure # TODO: RUSTPYTHON
843810
def test_errors(self):
844811
tests = [
845812
(b'\xff', '\ufffd'),
@@ -861,11 +828,6 @@ def test_nonbmp(self):
861828
self.assertEqual(b'\x00\xd8\x03\xde'.decode(self.encoding),
862829
"\U00010203")
863830

864-
@unittest.expectedFailure # TODO: RUSTPYTHON
865-
def test_lone_surrogates(self):
866-
return super().test_lone_surrogates()
867-
868-
@unittest.expectedFailure # TODO: RUSTPYTHON; IndexError: index out of range
869831
def test_incremental_surrogatepass(self):
870832
return super().test_incremental_surrogatepass()
871833

@@ -874,7 +836,6 @@ class UTF16BETest(ReadTest, unittest.TestCase):
874836
encoding = "utf-16-be"
875837
ill_formed_sequence = b"\xdc\x80"
876838

877-
@unittest.expectedFailure # TODO: RUSTPYTHON; UnicodeDecodeError: 'utf-16' codec can't decode bytes in position 0-1: unexpected end of data
878839
def test_partial(self):
879840
self.check_partial(
880841
"\x00\xff\u0100\uffff\U00010000",
@@ -894,7 +855,6 @@ def test_partial(self):
894855
]
895856
)
896857

897-
@unittest.expectedFailure # TODO: RUSTPYTHON
898858
def test_errors(self):
899859
tests = [
900860
(b'\xff', '\ufffd'),
@@ -916,11 +876,6 @@ def test_nonbmp(self):
916876
self.assertEqual(b'\xd8\x00\xde\x03'.decode(self.encoding),
917877
"\U00010203")
918878

919-
@unittest.expectedFailure # TODO: RUSTPYTHON
920-
def test_lone_surrogates(self):
921-
return super().test_lone_surrogates()
922-
923-
@unittest.expectedFailure # TODO: RUSTPYTHON; UnicodeDecodeError: 'utf-16' codec can't decode bytes in position 0-1: unexpected end of data
924879
def test_incremental_surrogatepass(self):
925880
return super().test_incremental_surrogatepass()
926881

@@ -970,7 +925,6 @@ def test_decode_error(self):
970925
self.assertEqual(data.decode(self.encoding, error_handler),
971926
expected)
972927

973-
@unittest.expectedFailure # TODO: RUSTPYTHON
974928
def test_lone_surrogates(self):
975929
super().test_lone_surrogates()
976930
# not sure if this is making sense for
@@ -1023,7 +977,6 @@ def test_incremental_errors(self):
1023977
class UTF7Test(ReadTest, unittest.TestCase):
1024978
encoding = "utf-7"
1025979

1026-
@unittest.expectedFailure # TODO: RUSTPYTHON
1027980
def test_ascii(self):
1028981
# Set D (directly encoded characters)
1029982
set_d = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -1050,7 +1003,6 @@ def test_ascii(self):
10501003
b'+AAAAAQACAAMABAAFAAYABwAIAAsADAAOAA8AEAARABIAEwAU'
10511004
b'ABUAFgAXABgAGQAaABsAHAAdAB4AHwBcAH4Afw-')
10521005

1053-
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: expected at least 5 arguments, got 1
10541006
def test_partial(self):
10551007
self.check_partial(
10561008
'a+-b\x00c\x80d\u0100e\U00010000f',
@@ -1090,7 +1042,6 @@ def test_partial(self):
10901042
]
10911043
)
10921044

1093-
@unittest.expectedFailure # TODO: RUSTPYTHON
10941045
def test_errors(self):
10951046
tests = [
10961047
(b'\xffb', '\ufffdb'),
@@ -1121,7 +1072,6 @@ def test_errors(self):
11211072
raw, 'strict', True)
11221073
self.assertEqual(raw.decode('utf-7', 'replace'), expected)
11231074

1124-
@unittest.expectedFailure # TODO: RUSTPYTHON
11251075
def test_nonbmp(self):
11261076
self.assertEqual('\U000104A0'.encode(self.encoding), b'+2AHcoA-')
11271077
self.assertEqual('\ud801\udca0'.encode(self.encoding), b'+2AHcoA-')
@@ -1137,7 +1087,6 @@ def test_nonbmp(self):
11371087
self.assertEqual(b'+IKwgrNgB3KA'.decode(self.encoding),
11381088
'\u20ac\u20ac\U000104A0')
11391089

1140-
@unittest.expectedFailure # TODO: RUSTPYTHON
11411090
def test_lone_surrogates(self):
11421091
tests = [
11431092
(b'a+2AE-b', 'a\ud801b'),
@@ -1158,15 +1107,9 @@ def test_lone_surrogates(self):
11581107
with self.subTest(raw=raw):
11591108
self.assertEqual(raw.decode('utf-7', 'replace'), expected)
11601109

1161-
@unittest.expectedFailure # TODO: RUSTPYTHON
1162-
def test_bug1175396(self):
1163-
return super().test_bug1175396()
1164-
1165-
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: expected at least 5 arguments, got 1
11661110
def test_readline(self):
11671111
return super().test_readline()
11681112

1169-
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: utf_7_decode() takes from 1 to 2 positional arguments but 3 were given
11701113
def test_incremental_surrogatepass(self):
11711114
return super().test_incremental_surrogatepass()
11721115

@@ -3062,7 +3005,6 @@ def test_latin1(self):
30623005

30633006

30643007
class BomTest(unittest.TestCase):
3065-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'codecs' has no attribute 'utf_32_ex_decode'. Did you mean: 'utf_16_ex_decode'?
30663008
def test_seek0(self):
30673009
data = "1234567890"
30683010
tests = ("utf-16",
@@ -3457,7 +3399,7 @@ def test_invalid_code_page(self):
34573399
self.assertRaises(OSError, codecs.code_page_encode, 123, 'a')
34583400
self.assertRaises(OSError, codecs.code_page_decode, 123, b'a')
34593401

3460-
@unittest.expectedFailure # TODO: RUSTPYTHON
3402+
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
34613403
def test_code_page_name(self):
34623404
self.assertRaisesRegex(UnicodeEncodeError, 'cp932',
34633405
codecs.code_page_encode, 932, '\xff')
@@ -3524,7 +3466,7 @@ def check_encode(self, cp, tests):
35243466
self.assertRaises(UnicodeEncodeError,
35253467
text.encode, f'cp{cp}', errors)
35263468

3527-
@unittest.expectedFailure # TODO: RUSTPYTHON
3469+
@unittest.expectedFailure # TODO: RUSTPYTHON
35283470
def test_cp932(self):
35293471
self.check_encode(932, (
35303472
('abc', 'strict', b'abc'),
@@ -3559,7 +3501,7 @@ def test_cp932(self):
35593501
(b'\x81\x00abc', 'backslashreplace', '\\x81\x00abc'),
35603502
))
35613503

3562-
@unittest.expectedFailure # TODO: RUSTPYTHON
3504+
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
35633505
def test_cp1252(self):
35643506
self.check_encode(1252, (
35653507
('abc', 'strict', b'abc'),
@@ -3633,7 +3575,7 @@ def test_cp20106(self):
36333575
(b'(\xbf)', 'surrogatepass', None),
36343576
))
36353577

3636-
@unittest.expectedFailure # TODO: RUSTPYTHON
3578+
@unittest.expectedFailure # TODO: RUSTPYTHON # TODO: RUSTPYTHON
36373579
def test_cp_utf7(self):
36383580
cp = 65000
36393581
self.check_encode(cp, (
@@ -3654,7 +3596,7 @@ def test_cp_utf7(self):
36543596
(b'[\xff]', 'strict', '[\xff]'),
36553597
))
36563598

3657-
@unittest.expectedFailure # TODO: RUSTPYTHON
3599+
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
36583600
def test_multibyte_encoding(self):
36593601
self.check_decode(932, (
36603602
(b'\x84\xe9\x80', 'ignore', '\u9a3e'),
@@ -3688,7 +3630,7 @@ def test_code_page_decode_flags(self):
36883630
self.assertEqual(codecs.code_page_decode(42, b'abc'),
36893631
('\uf061\uf062\uf063', 3))
36903632

3691-
@unittest.expectedFailure # TODO: RUSTPYTHON
3633+
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
36923634
def test_incremental(self):
36933635
decoded = codecs.code_page_decode(932, b'\x82', 'strict', False)
36943636
self.assertEqual(decoded, ('', 0))

Lib/test/test_fileinput.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,6 @@ def check(errors, expected_lines):
980980
check('replace', ['\ufffdabc'])
981981
check('backslashreplace', ['\\x80abc'])
982982

983-
# TODO: RUSTPYTHON
984-
@unittest.expectedFailure
985983
def test_modes(self):
986984
with open(TESTFN, 'wb') as f:
987985
# UTF-7 is a convenient, seldom used encoding

Lib/test/test_gzip.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,6 @@ def test_encoding_error_handler(self):
10361036
as f:
10371037
self.assertEqual(f.read(), "foobar")
10381038

1039-
@unittest.expectedFailure # TODO: RUSTPYTHON
10401039
def test_newline(self):
10411040
# Test with explicit newline (universal newline mode disabled).
10421041
uncompressed = data1.decode("ascii") * 50

0 commit comments

Comments
 (0)