def buttonClicked1(self,keywords): self.content2.setPlainText(self.content2.toPlainText()) string = self.content2.toPlainText() file_write_obj = open(r'test.txt', 'a+') # 以写的方式打开文件,如果文件不存在,就会自动创建 count = len(open(r'test.txt','rU').readlines()) file_write_obj.writelines(str(count)+":"+string) file_write_obj.write('\n') file_write_obj.close() ff.main()
def test_main_entry_with_extra_columns(self): self.args.filepath = file_test("Ten.columns.tab") self.args.json_filter = file_test("extra_cols.json") self.args.numeric_cols = ["MakeUp.Name", "Other.Column"] df = ff.main(self.args) self.assertEqual(df.shape, (1, 10))
def test_multiple_argument_loading(self): args = ff.argparser([ "--column-contains", self.gene_file, "--filepath", self.tab_file, "--json-filter", self.json_filter ]) df = ff.main(args) self.assertEqual(df.shape, (4, 151))
def test_main_entry_filter_correctly_with_ext(self): class Arg(object): json_filter = self.json_filter filepath = self.tab_file column_contains = [file_test("Gene.refGene.txt")] args = Arg() df = ff.main(args) self.assertEqual(df.shape, (4, 151))
def test_main_entry_with_non_existant_columns(self): self.args.json_filter = file_test("fake_columns.json") with self.assertLogs("ff", level="INFO") as log: df = ff.main(self.args) assert log.output == \ ["ERROR:ff:{}{}{}".format( Fore.RED, "Column not found (Random.FLOAT.Column).", Style.RESET_ALL), "ERROR:ff:{}{}{}".format( Fore.RED, "Column not found (Random.CONTAIN.Column).", Style.RESET_ALL)] # All rows are selected self.assertEqual(df.shape, (249, 151))
def test_main_entry_filter_correctly(self): df = ff.main(self.args) self.assertEqual(df.shape, (7, 151))