def test_print_file(self):
     string = "aaa\tintergenic\tsRNA\t10\t15\t.\t+\t."
     nums = {'pro': 3, 'tss': 3, 'uni': 0, 'cds': 3, 'ta': 3}
     out_table = StringIO()
     output = StringIO()
     srna_datas = {"high": 20, "low": 5, "best": 13,
                   "conds": {"cond1": "test1"},
                   "detail": [{"track": "test1", "high": 30,
                               "low": 10, "avg": 15},
                              {"track": "test2", "high": 25,
                               "low": 13, "avg": 20}]}
     args = self.mock_args.mock()
     args.nums = nums
     args.out_table = out_table
     args.output = output
     args.table_best = False
     si.print_file(string, "TSS_160+", srna_datas, "intergenic",
                   args, "aaa")
     self.assertEqual(out_table.getvalue(),
                      ("aaa\t00000\t10\t15\t+\tcond1\ttest1\t13\t20\t5\t"
                       "TSS_160+\ttest1(avg=15;high=30;low=10);"
                       "test2(avg=20;high=25;low=13)\n"))
     self.assertEqual(output.getvalue(),
                      ("aaa\tintergenic\tsRNA\t10\t15\t.\t+\t.\t"
                       "ID=aaa_srna0;Name=sRNA_00000;sRNA_type=intergenic;"
                       "with_TSS=TSS_160+;best_avg_coverage=13;"
                       "best_high_coverage=20;best_low_coverage=5\n"))
 def test_print_file(self):
     string = "aaa\tintergenic\tsRNA\t10\t15\t.\t+\t."
     nums = {'pro': 3, 'tss': 3, 'uni': 0, 'cds': 3, 'ta': 3}
     out_table = StringIO()
     output = StringIO()
     srna_datas = {"high": 20, "low": 5, "best": 13,
                   "conds": {"cond1": "test1"},
                   "detail": [{"track": "test1", "high": 30,
                               "low": 10, "avg": 15},
                              {"track": "test2", "high": 25,
                               "low": 13, "avg": 20}]}
     args = self.mock_args.mock()
     args.nums = nums
     args.out_table = out_table
     args.output = output
     args.table_best = False
     si.print_file(string, "TSS_160+", srna_datas, "intergenic",
                   args, "aaa")
     self.assertEqual(out_table.getvalue(),
                      ("aaa\t00000\t10\t15\t+\tcond1\ttest1\t13\t20\t5\t"
                       "TSS_160+\ttest1(avg=15;high=30;low=10);"
                       "test2(avg=20;high=25;low=13)\n"))
     self.assertEqual(output.getvalue(),
                      ("aaa\tintergenic\tsRNA\t10\t15\t.\t+\t.\t"
                       "ID=aaa_srna0;Name=sRNA_00000;sRNA_type=intergenic;"
                       "with_TSS=TSS_160+;best_avg_coverage=13;"
                       "best_high_coverage=20;best_low_coverage=5\n"))