Module Expr Str Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str Import alias FunctionDef arguments args NameParam NameParam defaults body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str For NameStore Call NameLoad NameLoad body Assign NameStore ListLoad Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpAdd Call AttributeLoad NameLoad attr NameLoad Str Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call NameLoad keyword Str keyword Num Assign AttributeStore NameLoad attr Call NameLoad keyword Str keyword Num Assign TupleStore NameStore AttributeStore NameLoad attr Call AttributeLoad NameLoad attr keyword Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assert CompareEq Call NameLoad NameLoad Num Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assert CompareIn Str AttributeLoad NameLoad attr Assert CompareEq Call NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assert CompareEq Call NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assert CompareEq Call NameLoad NameLoad Num Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assert CompareEq Call NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assert CompareEq Call NameLoad NameLoad Num Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str Assert Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str decorator_list decorator_list
N/A N/A  To do:
      1.  Add testing for stdout - but can be hard because it has interactive prompting.
      2.  Add testing for a recnum > last record in the file

    See the file "LICENSE" for the full license governing this code. 
    Copyright 2011 Ken Farmer
 N/A sys N/A os N/A tempfile N/A random N/A time N/A fileinput N/A subprocess N/A imp N/A envoy N/A pytest N/A script_path N/A N/A N/A os path dirname N/A N/A N/A os path dirname N/A N/A N/A os path realpath __file__ N/A fq_pgm N/A N/A N/A os path join script_path gristle_viewer N/A test_tools generate_test_file N/A N/A delim record_cnt N/A N/A N/A N/A fd fqfn N/A N/A tempfile mkstemp prefix ViewerTestIn_ N/A fp N/A N/A os fdopen fd w N/A i N/A range record_cnt N/A N/A fields N/A N/A N/A N/A fields append N/A str i N/A N/A N/A fields append A N/A N/A N/A fields append B N/A N/A N/A fields append C N/A N/A N/A fp write N/A N/A N/A delim join fields N/A N/A N/A fp close N/A fqfn N/A TestCommandLine N/A object N/A setup_method N/A N/A self method N/A N/A N/A N/A self in_fqfn N/A generate_test_file delim | record_cnt 100 N/A N/A self empty_fqfn N/A generate_test_file delim | record_cnt 0 N/A N/A dummy N/A self out_fqfn N/A N/A tempfile mkstemp prefix ViewerTestOut_ N/A teardown_method N/A N/A self method N/A N/A N/A N/A N/A os remove N/A self in_fqfn N/A N/A N/A os remove N/A self out_fqfn N/A N/A N/A test_tools temp_file_remover N/A N/A N/A os path join N/A N/A tempfile gettempdir ViewerTest N/A test_easy_file N/A N/A self N/A N/A N/A cmd N/A %s %s -r 10 -o %s N/A fq_pgm N/A self in_fqfn N/A self out_fqfn N/A r N/A N/A envoy run cmd N/A p_recs N/A N/A rec N/A N/A fileinput input N/A self out_fqfn N/A N/A N/A N/A p_recs append rec N/A N/A N/A fileinput close N/A N/A N/A len p_recs 4 N/A N/A N/A N/A N/A N/A p_recs N/A 0 strip startswith field_0 N/A N/A N/A N/A N/A N/A p_recs N/A 0 strip endswith 10 N/A N/A N/A N/A N/A N/A p_recs N/A 1 strip startswith field_1 N/A N/A N/A N/A N/A N/A p_recs N/A 1 strip endswith A N/A N/A N/A N/A N/A N/A p_recs N/A 2 strip startswith field_2 N/A N/A N/A N/A N/A N/A p_recs N/A 2 strip endswith B N/A N/A N/A N/A N/A N/A p_recs N/A 3 strip startswith field_3 N/A N/A N/A N/A N/A N/A p_recs N/A 3 strip endswith C N/A test_bad_recnum N/A N/A self N/A N/A N/A  Shows that the program when given a recnum that doesn't exist will
            write no rows to the output file and print only a comment to stdout

            To do:
                - check for a negative number
                - check for return code
         N/A p_outrecs N/A N/A cmd N/A %s %s -r 999 -o %s N/A fq_pgm N/A self in_fqfn N/A self out_fqfn N/A r N/A N/A envoy run cmd N/A rec N/A N/A fileinput input N/A self out_fqfn N/A N/A N/A N/A p_outrecs append rec N/A N/A N/A fileinput close N/A N/A No record found N/A r std_out N/A N/A N/A len p_outrecs 0 N/A test_empty_file N/A N/A self N/A N/A N/A cmd N/A %s %s -o %s -r 999  N/A fq_pgm N/A self empty_fqfn N/A self out_fqfn N/A r N/A N/A envoy run cmd N/A out_recs N/A N/A rec N/A N/A fileinput input N/A self out_fqfn N/A N/A N/A N/A out_recs append rec N/A N/A N/A fileinput close N/A N/A N/A len out_recs 0 N/A test_full_multiple_files N/A N/A self N/A N/A N/A cmd N/A %s %s %s -o %s -r 10 -d'|' N/A fq_pgm N/A self in_fqfn N/A self in_fqfn N/A self out_fqfn N/A r N/A N/A envoy run cmd N/A out_recs N/A N/A rec N/A N/A fileinput input N/A self out_fqfn N/A N/A N/A N/A out_recs append rec N/A N/A N/A fileinput close N/A N/A N/A len out_recs 4 N/A N/A N/A N/A N/A N/A out_recs N/A 0 strip startswith field_0 N/A N/A N/A N/A N/A N/A out_recs N/A 0 strip endswith 10 N/A test_full_multiple_empty_files N/A N/A self N/A N/A N/A cmd N/A %s %s %s -o %s -r 10 -d'|' N/A fq_pgm N/A self empty_fqfn N/A self empty_fqfn N/A self out_fqfn N/A r N/A N/A envoy run cmd N/A out_recs N/A N/A rec N/A N/A fileinput input N/A self out_fqfn N/A N/A N/A N/A out_recs append rec N/A N/A N/A fileinput close N/A N/A N/A len out_recs 0 N/A dtest_full_multiple_empty_and_full_files N/A N/A self N/A N/A N/A cmd N/A %s %s %s -o %s -r 10 -d'|' N/A fq_pgm N/A self empty_fqfn N/A self in_fqfn N/A self out_fqfn N/A r N/A N/A envoy run cmd N/A out_recs N/A N/A rec N/A N/A fileinput input N/A self out_fqfn N/A N/A N/A N/A out_recs append rec N/A N/A N/A fileinput close N/A N/A N/A len out_recs 4 N/A N/A N/A N/A N/A N/A out_recs N/A 0 strip startswith field_0 N/A N/A N/A N/A N/A N/A out_recs N/A 0 strip endswith 10 N/A N/A