def test_02_parse_text_to_table(self):
		tab_data = """animal	bird	dove
animal	bird	duck
animal	fish	salmon
life	plant	vegetable	pea
life	plant	vegetable	potato		"""
		t2 = text_tools.parse_text_to_table(tab_data)
		#print(t2)
		self.assertEqual(len(t2),5)
		self.assertEqual(t2[0], ['animal', 'bird', 'dove'])
		self.assertEqual(t2[4], ['life', 'plant', 'vegetable', 'potato', '', ''])
		text_tools.save_tbl_as_csv(t2, 'text_tools_sample.csv')
		self.assertEqual(os.path.exists('text_tools_sample.csv'), True)
示例#2
0
    def test_02_parse_text_to_table(self):
        tab_data = """animal	bird	dove		
animal	bird	duck		
animal	fish	salmon		
life	plant	vegetable	pea		
life	plant	vegetable	potato		"""
        t2 = text_tools.parse_text_to_table(tab_data)
        #print(t2)
        self.assertEqual(len(t2),5)
        self.assertEqual(t2[0], ['animal', 'bird', 'dove', '', ''])
        self.assertEqual(t2[4], ['life', 'plant', 'vegetable', 'potato', '', ''])
        text_tools.save_tbl_as_csv(t2, 'text_tools_sample.csv')
        self.assertEqual(os.path.exists('text_tools_sample.csv'), True)
	def test_06_parse_text_to_table(self):
		test_hdr = 'Name,Address,zip,,,,'
		delim = text_tools.identify_delim(test_hdr)
		self.assertEqual(delim, ',')
		t3 = text_tools.parse_text_to_table(test_hdr)
		self.assertEqual(t3, [['Name', 'Address', 'zip', '', '', '', '']])
	def test_04_parse_text_fixed_delim(self):
		t4 = text_tools.parse_text_to_table('Hi\nLo\n')
		self.assertEqual(t4, [['Hi'], ['Lo']])
	def test_01_parse_text_to_table(self):
		t1 = text_tools.parse_text_to_table('aaa,bdsdsbb,cfe\nAAA,BB,C\na,bb,ccc\n')
		self.assertEqual(t1,[['aaa', 'bdsdsbb', 'cfe'], ['AAA', 'BB', 'C'], ['a', 'bb', 'ccc']])
示例#6
0
 def test_06_parse_text_to_table(self):
     test_hdr = 'Name,Address,zip,,,,'
     delim = text_tools.identify_delim(test_hdr)
     self.assertEqual(delim, ',')
     t3 = text_tools.parse_text_to_table(test_hdr)   
     self.assertEqual(t3, [['Name', 'Address', 'zip', '', '', '', '']])
示例#7
0
 def test_04_parse_text_fixed_delim(self):
     t4 = text_tools.parse_text_to_table('Hi\nLo\n')   
     self.assertEqual(t4, [['Hi'], ['Lo']])
示例#8
0
 def test_01_parse_text_to_table(self):
     t1 = text_tools.parse_text_to_table('aaa,bdsdsbb,cfe\nAAA,BB,C\na,bb,ccc\n')
     self.assertEqual(t1,[['aaa', 'bdsdsbb', 'cfe'], ['AAA', 'BB', 'C'], ['a', 'bb', 'ccc']])