Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d24a5b6

Browse files
committed
Added a longish test case to stress seek/tell with a stateful decoder.
1 parent e25f35e commit d24a5b6

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

Lib/test/test_io.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -577,20 +577,30 @@ class StatefulIncrementalDecoderTest(unittest.TestCase):
577577
"""
578578

579579
test_cases = [
580-
# I=1 fixed-length mode
580+
# I=1, O=1 (fixed-length input == fixed-length output)
581581
(b'abcd', False, 'a.b.c.d.'),
582-
# I=0, O=0, variable-length mode
582+
# I=0, O=0 (variable-length input, variable-length output)
583583
(b'oiabcd', True, 'abcd.'),
584-
# I=0, O=0, variable-length mode, should ignore extra periods
584+
# I=0, O=0 (should ignore extra periods)
585585
(b'oi...abcd...', True, 'abcd.'),
586-
# I=0, O=6
587-
(b'i.o6.xyz.', False, 'xyz---.'),
588-
# I=2, O=6
586+
# I=0, O=6 (variable-length input, fixed-length output)
587+
(b'i.o6.x.xyz.toolongtofit.', False, 'x-----.xyz---.toolon.'),
588+
# I=2, O=6 (fixed-length input < fixed-length output)
589589
(b'i.i2.o6xyz', True, 'xy----.z-----.'),
590-
# I=0, O=3
591-
(b'i.o3.x.xyz.toolong.', False, 'x--.xyz.too.'),
592-
# I=6, O=3
593-
(b'i.o3.i6.abcdefghijklmnop', True, 'abc.ghi.mno.')
590+
# I=6, O=3 (fixed-length input > fixed-length output)
591+
(b'i.o3.i6.abcdefghijklmnop', True, 'abc.ghi.mno.'),
592+
# I=0, then 3; O=29, then 15 (with longer output)
593+
(b'i.o29.a.b.cde.o15.abcdefghijabcdefghij.i3.a.b.c.d.ei00k.l.m', True,
594+
'a----------------------------.' +
595+
'b----------------------------.' +
596+
'cde--------------------------.' +
597+
'abcdefghijabcde.' +
598+
'a.b------------.' +
599+
'.c.------------.' +
600+
'd.e------------.' +
601+
'k--------------.' +
602+
'l--------------.' +
603+
'm--------------.')
594604
]
595605

596606
def testDecoder(self):

0 commit comments

Comments
 (0)