Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
test.test_io.StatefulIncrementalDecoderTest Class Reference

List of all members.

Public Member Functions

def test_decoder

Static Public Attributes

list test_cases

Detailed Description

Make sure the StatefulIncrementalDecoder actually works.

Definition at line 1676 of file test_io.py.


Member Function Documentation

Definition at line 1708 of file test_io.py.

01708 
01709     def test_decoder(self):
01710         # Try a few one-shot test cases.
01711         for input, eof, output in self.test_cases:
01712             d = StatefulIncrementalDecoder()
01713             self.assertEqual(d.decode(input, eof), output)
01714 
01715         # Also test an unfinished decode, followed by forcing EOF.
01716         d = StatefulIncrementalDecoder()
01717         self.assertEqual(d.decode(b'oiabcd'), '')
01718         self.assertEqual(d.decode(b'', 1), 'abcd.')

Here is the call graph for this function:


Member Data Documentation

Initial value:
[
        # I=1, O=1 (fixed-length input == fixed-length output)
        (b'abcd', False, 'a.b.c.d.'),
        # I=0, O=0 (variable-length input, variable-length output)
        (b'oiabcd', True, 'abcd.'),
        # I=0, O=0 (should ignore extra periods)
        (b'oi...abcd...', True, 'abcd.'),
        # I=0, O=6 (variable-length input, fixed-length output)
        (b'i.o6.x.xyz.toolongtofit.', False, 'x-----.xyz---.toolon.'),
        # I=2, O=6 (fixed-length input < fixed-length output)
        (b'i.i2.o6xyz', True, 'xy----.z-----.'),
        # I=6, O=3 (fixed-length input > fixed-length output)
        (b'i.o3.i6.abcdefghijklmnop', True, 'abc.ghi.mno.'),
        # I=0, then 3; O=29, then 15 (with longer output)
        (b'i.o29.a.b.cde.o15.abcdefghijabcdefghij.i3.a.b.c.d.ei00k.l.m', True,
         'a----------------------------.' +
         'b----------------------------.' +
         'cde--------------------------.' +
         'abcdefghijabcde.' +
         'a.b------------.' +
         '.c.------------.' +
         'd.e------------.' +
         'k--------------.' +
         'l--------------.' +
         'm--------------.')
    ]

Definition at line 1681 of file test_io.py.


The documentation for this class was generated from the following file: