<s> import unittest <EOL> from test import support <EOL> import io <EOL> class TextIOWrapperTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . testdata = b"<STR_LIT>" <EOL> self . normalized = b"<STR_LIT>" . decode ( "<STR_LIT>" ) <EOL> def tearDown ( self ) : <EOL> support . unlink ( support . TESTFN ) <EOL> def test_issue1395_1 ( self ) : <EOL> txt = io . TextIOWrapper ( io . BytesIO ( self . testdata ) , encoding = "<STR_LIT>" ) <EOL> reads = "<STR_LIT>" <EOL> while True : <EOL> c = txt . read ( <NUM_LIT:1> ) <EOL> if not c : <EOL> break <EOL> reads += c <EOL> self . assertEqual ( reads , self . normalized ) <EOL> def test_issue1395_2 ( self ) : <EOL> txt = io . TextIOWrapper ( io . BytesIO ( self . testdata ) , encoding = "<STR_LIT>" ) <EOL> txt . _CHUNK_SIZE = <NUM_LIT:4> <EOL> reads = "<STR_LIT>" <EOL> while True : <EOL> c = txt . read ( <NUM_LIT:4> ) <EOL> if not c : <EOL> break <EOL> reads += c <EOL> self . assertEqual ( reads , self . normalized ) <EOL> def test_issue1395_3 ( self ) : <EOL> txt = io . TextIOWrapper ( io . BytesIO ( self . testdata ) , encoding = "<STR_LIT>" ) <EOL> txt . _CHUNK_SIZE = <NUM_LIT:4> <EOL> reads = txt . read ( <NUM_LIT:4> ) <EOL> reads += txt . read ( <NUM_LIT:4> ) <EOL> reads += txt . readline ( ) <EOL> reads += txt . readline ( ) <EOL> reads += txt . readline ( ) <EOL> self . assertEqual ( reads , self . normalized ) <EOL> def test_issue1395_4 ( self ) : <EOL> txt = io . TextIOWrapper ( io . BytesIO ( self . testdata ) , encoding = "<STR_LIT>" ) <EOL> txt . _CHUNK_SIZE = <NUM_LIT:4> <EOL> reads = txt . read ( <NUM_LIT:4> ) <EOL> reads += txt . read ( ) <EOL> self . assertEqual ( reads , self . normalized ) <EOL> def test_issue1395_5 ( self ) : <EOL> txt = io . TextIOWrapper ( io . BytesIO ( self . testdata ) , encoding = "<STR_LIT>" ) <EOL> txt . _CHUNK_SIZE = <NUM_LIT:4> <EOL> reads = txt . read ( <NUM_LIT:4> ) <EOL> pos = txt . tell ( ) <EOL> txt . seek ( <NUM_LIT:0> ) <EOL> txt . seek ( pos ) <EOL> self . assertEqual ( txt . read ( <NUM_LIT:4> ) , "<STR_LIT>" ) <EOL> def test_main ( ) : <EOL> support . run_unittest ( <EOL> TextIOWrapperTest ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test_main ( ) </s>
