def test_cut_file_keepagename_pipe(self): cut.cut_file(self.pipefile, self.outfile, keep_list=['age', 'name'], delimiter='|') result = self.outfile.getvalue() self.assertEqual('age|name\r\n1|ian\r\n2|daniel\r\n3|chang\r\n', result)
def test_cut_file_keepagename(self): cut.cut_file(self.commafile, self.outfile, keep_list=['age', 'name']) result = self.outfile.getvalue() self.assertEqual('age,name\r\n1,ian\r\n2,daniel\r\n3,chang\r\n', result)
def test_cut_file_removename(self): cut.cut_file(self.commafile, self.outfile, remove_list=['name']) result = self.outfile.getvalue() self.assertEqual('age,weight\r\n1,11\r\n2,22\r\n3,33\r\n', result)
def test_cut_file_keepnameage(self): cut.cut_file(self.commafile, self.outfile, keep_list=['name', 'age']) result = self.outfile.getvalue() self.assertEqual('name,age\r\nian,1\r\ndaniel,2\r\nchang,3\r\n', result)
def test_cut_file_keepname(self): cut.cut_file(self.commafile, self.outfile, keep_list=['name']) result = self.outfile.getvalue() self.assertEqual('name\r\nian\r\ndaniel\r\nchang\r\n', result)