Module Expr Str Import alias ImportFrom alias alias alias ImportFrom alias identifier Import alias alias ImportFrom alias ImportFrom alias alias FunctionDef arguments args NameParam NameParam NameParam defaults Str body Assign NameStore BinOpAdd NameLoad Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args defaults vararg body For NameStore NameLoad body Expr Call NameLoad NameLoad decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body For TupleStore NameStore NameStore TupleLoad TupleLoad Num Num TupleLoad Num Num body TryFinally body Assign NameStore Call NameLoad Num ListComp BinOpMod Str BinOpAdd NameLoad Num comprehension NameStore Call NameLoad Num Assign NameStore Call NameLoad Num ListComp BinOpMod Str BinOpAdd NameLoad Num comprehension NameStore Call NameLoad Num Assign NameStore Call NameLoad Num ListComp BinOpMod Str BinOpAdd NameLoad Num comprehension NameStore Call NameLoad Num Assign NameStore Call NameLoad Num ListComp BinOpMod Str BinOpAdd NameLoad Num comprehension NameStore Call NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad finalbody Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Num Num body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore BinOpAdd Num BinOpMult NameLoad Num If NameLoad body Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad Assign NameStore Call NameLoad keyword TupleLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Str Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad Assign NameStore Call NameLoad keyword TupleLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad Assign NameStore Str While BoolOpAnd NameLoad CompareNotEq NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr If NameLoad body Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr If NameLoad body Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad Assign NameStore Call NameLoad keyword TupleLoad NameLoad NameLoad NameLoad NameLoad Str keyword NameLoad Assign NameStore AttributeLoad NameLoad attr TryFinally body Assign AttributeStore NameLoad attr Call NameLoad Str Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr finalbody Assign AttributeStore NameLoad attr NameLoad If NameLoad body Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad Assign NameStore Call NameLoad keyword TupleLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad Assign NameStore AttributeLoad NameLoad attr TryFinally body Assign NameStore Call NameLoad keyword TupleLoad NameLoad NameLoad NameLoad NameLoad keyword Num keyword NameLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Slice Num attr Print NameLoad Expr Call AttributeLoad NameLoad attr finalbody Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call NameLoad keyword TupleLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Str Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body TryFinally body Assign NameStore Call NameLoad Num ListLoad Str Assign NameStore Call NameLoad Num ListLoad Str Assign NameStore Call NameLoad Num ListLoad Str Assign NameStore Call NameLoad Num ListLoad Str Assign NameStore Call NameLoad keyword TupleLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr finalbody Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body TryFinally body Assign NameStore Call NameLoad Num ListLoad Str Assign NameStore Call NameLoad Num ListLoad Str Assign NameStore Call NameLoad keyword TupleLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad ListLoad Str Str Str Str Str Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num finalbody Expr Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body TryFinally body Assign NameStore Call NameLoad Num ListLoad Str Assign NameStore Call AttributeLoad NameLoad attr If CompareIs NameLoad NameLoad body Assign NameStore Str Assign NameStore Call NameLoad keyword Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad ListLoad Str Str finalbody Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body TryFinally body Assign NameStore Call NameLoad Num ListLoad Str Assign NameStore Call NameLoad Num ListLoad Str Assign NameStore Call NameLoad keyword TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num finalbody Expr Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body TryExcept body Assign NameStore Call NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str handlers ExceptHandler type NameLoad body Pass TryFinally body Assign NameStore Call NameLoad Num ListLoad Str keyword Str Assign NameStore Call NameLoad keyword NameLoad keyword Str Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad ListLoad Str Str Str Str finalbody Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body TryExcept body Assign NameStore Call NameLoad keyword Num keyword Lambda arguments args NameParam NameParam defaults NameLoad Expr Call AttributeLoad NameLoad attr Str handlers ExceptHandler type NameLoad body Pass TryExcept body Assign NameStore Call NameLoad keyword Num Expr Call AttributeLoad NameLoad attr Str handlers ExceptHandler type NameLoad body Pass TryFinally body Assign NameStore Call NameLoad Num ListLoad Str keyword Str Assign NameStore Call NameLoad keyword NameLoad keyword Call NameLoad Str Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad ListLoad Str Str finalbody Expr Call NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args defaults body Expr Call NameLoad NameLoad NameLoad decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A 
Tests for fileinput module.
Nick Mathewson
 N/A unittest test.test_support verbose TESTFN run_unittest test.test_support unlink safe_unlink N/A sys re StringIO StringIO fileinput FileInput hook_encoded writeTmp N/A N/A i lines mode N/A w N/A N/A name N/A TESTFN N/A str i N/A f N/A open name mode N/A N/A N/A f writelines lines N/A N/A N/A f close N/A name N/A remove_tempfiles N/A N/A N/A names N/A N/A name names N/A N/A N/A safe_unlink name N/A BufferSizesTests N/A N/A unittest TestCase N/A test_buffer_sizes N/A N/A self N/A N/A N/A N/A round bs N/A N/A 0 0 N/A 1 30 N/A N/A N/A N/A t1 N/A writeTmp 1 N/A N/A Line %s of file 1
 N/A i 1 N/A i N/A range 15 N/A t2 N/A writeTmp 2 N/A N/A Line %s of file 2
 N/A i 1 N/A i N/A range 10 N/A t3 N/A writeTmp 3 N/A N/A Line %s of file 3
 N/A i 1 N/A i N/A range 5 N/A t4 N/A writeTmp 4 N/A N/A Line %s of file 4
 N/A i 1 N/A i N/A range 1 N/A N/A N/A self buffer_size_test t1 t2 t3 t4 bs round N/A N/A N/A remove_tempfiles t1 t2 t3 t4 N/A buffer_size_test N/A N/A self t1 t2 t3 t4 bs round N/A 0 0 N/A N/A pat N/A N/A re compile LINE (\d+) OF FILE (\d+) N/A start N/A 1 N/A round 6 N/A verbose N/A N/A N/A %s. Simple iteration (bs=%s) N/A N/A start 0 bs N/A fi N/A FileInput files N/A t1 t2 t3 t4 bufsize bs N/A lines N/A list fi N/A N/A N/A fi close N/A N/A N/A self assertEqual N/A len lines 31 N/A N/A N/A self assertEqual N/A lines N/A 4 Line 5 of file 1
 N/A N/A N/A self assertEqual N/A lines N/A 30 Line 1 of file 4
 N/A N/A N/A self assertEqual N/A N/A fi lineno 31 N/A N/A N/A self assertEqual N/A N/A fi filename t4 N/A verbose N/A N/A N/A %s. Status variables (bs=%s) N/A N/A start 1 bs N/A fi N/A FileInput files N/A t1 t2 t3 t4 bufsize bs N/A s x N/A N/A s N/A s Line 6 of file 2
 N/A N/A s N/A N/A fi readline N/A N/A N/A self assertEqual N/A N/A fi filename t2 N/A N/A N/A self assertEqual N/A N/A fi lineno 21 N/A N/A N/A self assertEqual N/A N/A fi filelineno 6 N/A N/A N/A self assertFalse N/A N/A fi isfirstline N/A N/A N/A self assertFalse N/A N/A fi isstdin N/A verbose N/A N/A N/A %s. Nextfile (bs=%s) N/A N/A start 2 bs N/A N/A N/A fi nextfile N/A N/A N/A self assertEqual N/A N/A fi readline Line 1 of file 3
 N/A N/A N/A self assertEqual N/A N/A fi lineno 22 N/A N/A N/A fi close N/A verbose N/A N/A N/A %s. Stdin (bs=%s) N/A N/A start 3 bs N/A fi N/A FileInput files N/A t1 t2 t3 t4 - bufsize bs N/A savestdin N/A sys stdin N/A N/A N/A N/A sys stdin N/A StringIO Line 1 of stdin
Line 2 of stdin
 N/A lines N/A list fi N/A N/A N/A self assertEqual N/A len lines 33 N/A N/A N/A self assertEqual N/A lines N/A 32 Line 2 of stdin
 N/A N/A N/A self assertEqual N/A N/A fi filename <stdin> N/A N/A N/A fi nextfile N/A N/A N/A sys stdin savestdin N/A verbose N/A N/A N/A %s. Boundary conditions (bs=%s) N/A N/A start 4 bs N/A fi N/A FileInput files N/A t1 t2 t3 t4 bufsize bs N/A N/A N/A self assertEqual N/A N/A fi lineno 0 N/A N/A N/A self assertEqual N/A N/A fi filename None N/A N/A N/A fi nextfile N/A N/A N/A self assertEqual N/A N/A fi lineno 0 N/A N/A N/A self assertEqual N/A N/A fi filename None N/A verbose N/A N/A N/A %s. Inplace (bs=%s) N/A N/A start 5 bs N/A savestdout N/A sys stdout N/A N/A N/A fi N/A FileInput files N/A t1 t2 t3 t4 inplace 1 bufsize bs N/A line fi N/A N/A line N/A N/A N/A line N/A -1 upper N/A line N/A N/A N/A fi close N/A N/A N/A sys stdout savestdout N/A fi N/A FileInput files N/A t1 t2 t3 t4 bufsize bs N/A line fi N/A N/A N/A N/A self assertEqual N/A line N/A -1 N/A m N/A N/A pat match N/A line N/A -1 N/A N/A N/A self assertNotEqual m None N/A N/A N/A self assertEqual N/A int N/A N/A m group 1 N/A N/A fi filelineno N/A N/A N/A fi close N/A N/A FileInputTests N/A N/A unittest TestCase N/A test_zero_byte_files N/A N/A self N/A N/A N/A N/A N/A t1 N/A writeTmp 1 N/A N/A t2 N/A writeTmp 2 N/A N/A t3 N/A writeTmp 3 N/A The only line there is.
 N/A t4 N/A writeTmp 4 N/A N/A fi N/A FileInput files N/A t1 t2 t3 t4 N/A line N/A N/A fi readline N/A N/A N/A self assertEqual line The only line there is.
 N/A N/A N/A self assertEqual N/A N/A fi lineno 1 N/A N/A N/A self assertEqual N/A N/A fi filelineno 1 N/A N/A N/A self assertEqual N/A N/A fi filename t3 N/A line N/A N/A fi readline N/A N/A N/A self assertFalse line N/A N/A N/A self assertEqual N/A N/A fi lineno 1 N/A N/A N/A self assertEqual N/A N/A fi filelineno 0 N/A N/A N/A self assertEqual N/A N/A fi filename t4 N/A N/A N/A fi close N/A N/A N/A remove_tempfiles t1 t2 t3 t4 N/A test_files_that_dont_end_with_newline N/A N/A self N/A N/A N/A N/A N/A t1 N/A writeTmp 1 N/A A
B
C N/A t2 N/A writeTmp 2 N/A D
E
F N/A fi N/A FileInput files N/A t1 t2 N/A lines N/A list fi N/A N/A N/A self assertEqual lines N/A A
 B
 C D
 E
 F N/A N/A N/A self assertEqual N/A N/A fi filelineno 3 N/A N/A N/A self assertEqual N/A N/A fi lineno 6 N/A N/A N/A remove_tempfiles t1 t2 N/A test_unicode_filenames N/A N/A self N/A N/A N/A N/A N/A t1 N/A writeTmp 1 N/A A
B N/A encoding N/A N/A sys getfilesystemencoding N/A N/A encoding None N/A N/A encoding ascii N/A fi N/A FileInput files N/A unicode t1 encoding N/A lines N/A list fi N/A N/A N/A self assertEqual lines N/A A
 B N/A N/A N/A remove_tempfiles t1 N/A test_fileno N/A N/A self N/A N/A N/A N/A N/A t1 N/A writeTmp 1 N/A A
B N/A t2 N/A writeTmp 2 N/A C
D N/A fi N/A FileInput files N/A t1 t2 N/A N/A N/A self assertEqual N/A N/A fi fileno -1 N/A line N/A N/A fi next N/A N/A N/A self assertNotEqual N/A N/A fi fileno -1 N/A N/A N/A fi nextfile N/A N/A N/A self assertEqual N/A N/A fi fileno -1 N/A line N/A list fi N/A N/A N/A self assertEqual N/A N/A fi fileno -1 N/A N/A N/A remove_tempfiles t1 t2 N/A test_opening_mode N/A N/A self N/A N/A N/A N/A N/A fi N/A FileInput mode w N/A N/A N/A self fail FileInput should reject invalid mode argument N/A N/A N/A ValueError N/A N/A N/A N/A N/A t1 N/A writeTmp 1 N/A A
B
C
D mode wb N/A fi N/A FileInput files t1 mode U N/A lines N/A list fi N/A N/A N/A self assertEqual lines N/A A
 B
 C
 D N/A N/A N/A remove_tempfiles t1 N/A test_file_opening_hook N/A N/A self N/A N/A N/A N/A N/A fi N/A FileInput inplace 1 openhook N/A N/A N/A f m N/A None N/A N/A N/A self fail FileInput should raise if both inplace and openhook arguments are given N/A N/A N/A ValueError N/A N/A N/A N/A N/A fi N/A FileInput openhook 1 N/A N/A N/A self fail FileInput should check openhook for being callable N/A N/A N/A ValueError N/A N/A N/A N/A N/A t1 N/A writeTmp 1 N/A A
B mode wb N/A fi N/A FileInput files t1 openhook N/A hook_encoded rot13 N/A lines N/A list fi N/A N/A N/A self assertEqual lines N/A N
 O N/A N/A N/A remove_tempfiles t1 N/A N/A test_main N/A N/A N/A N/A N/A N/A run_unittest BufferSizesTests FileInputTests N/A N/A N/A __name__ __main__ N/A N/A N/A test_main