本文整理汇总了Python中outputty.Table._identify_type_of_data方法的典型用法代码示例。如果您正苦于以下问题:Python Table._identify_type_of_data方法的具体用法?Python Table._identify_type_of_data怎么用?Python Table._identify_type_of_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类outputty.Table
的用法示例。
在下文中一共展示了Table._identify_type_of_data方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_should_not_indentify_non_fractional_floats_as_int
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_should_not_indentify_non_fractional_floats_as_int(self):
table = Table(headers=["ham"])
table.append([1.0])
table.append([2.0])
table.append([3.0])
table._identify_type_of_data()
self.assertEqual(table.types["ham"], float)
示例2: test_should_indentify_type_float_correctly
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_should_indentify_type_float_correctly(self):
table = Table(headers=['ham'])
table.append(["3"])
table.append(["3.14"])
table.append([""])
table.append(["2.71"])
table._identify_type_of_data()
self.assertEqual(table.types['ham'], float)
示例3: test_empty_string_should_not_affect_data_type
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_empty_string_should_not_affect_data_type(self):
table = Table(headers=["spam", "eggs", "ham", "Monty", "Python"])
table.append([1, 2.71, "2011-01-01", "2011-01-01 00:00:00", "asd"])
table.append(["", "", "", "", ""])
table._identify_type_of_data()
self.assertEquals(table.types["spam"], int)
self.assertEquals(table.types["eggs"], float)
self.assertEquals(table.types["ham"], datetime.date)
self.assertEquals(table.types["Monty"], datetime.datetime)
self.assertEquals(table.types["Python"], str)
示例4: test_should_indentify_type_str_correctly
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_should_indentify_type_str_correctly(self):
table = Table(headers=["eggs", "ham"])
table.append(["spam eggs", 1])
table.append(["spam spam", 3.14])
table.append(["eggs spam", "testing"])
table.append(["spam spam", "2011-11-23"])
table.append(["spam ham", "2011-11-23 02:00:17"])
table._identify_type_of_data()
self.assertEqual(table.types["eggs"], str)
self.assertEqual(table.types["ham"], str)
示例5: test_empty_string_should_not_affect_data_type
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_empty_string_should_not_affect_data_type(self):
table = Table(headers=['spam', 'eggs', 'ham', 'Monty', 'Python'])
table.append([1, 2.71, '2011-01-01', '2011-01-01 00:00:00', 'asd'])
table.append(['', '', '', '', ''])
table._identify_type_of_data()
self.assertEquals(table.types['spam'], int)
self.assertEquals(table.types['eggs'], float)
self.assertEquals(table.types['ham'], datetime.date)
self.assertEquals(table.types['Monty'], datetime.datetime)
self.assertEquals(table.types['Python'], str)
示例6: test_should_indentify_type_str_correctly
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_should_indentify_type_str_correctly(self):
table = Table(headers=['eggs', 'ham'], input_encoding='iso-8859-1')
table.append(['spam eggs', 1])
table.append(['spam spam', 3.14])
table.append(['eggs spam', 'testing'])
table.append(['spam spam', '2011-11-23'])
table.append(['spam ham', '2011-11-23 02:00:17'])
table.append([u'álvaro'.encode('iso-8859-1'), '2011-11-23 02:00:17'])
table._identify_type_of_data()
self.assertEqual(table.types['eggs'], str)
self.assertEqual(table.types['ham'], str)
示例7: test_running_identify_data_type_with_normalized_types_should_return_correct_results
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_running_identify_data_type_with_normalized_types_should_return_correct_results(self):
table = Table(headers=['spam', 'eggs', 'ham', 'Monty', 'Python'])
table.append([1, 2.71, '2011-01-01', '2011-01-01 00:00:00', 'asd'])
table.append(['', '', '', '', ''])
table.normalize_types()
table._identify_type_of_data()
self.assertEquals(table.types['spam'], int)
self.assertEquals(table.types['eggs'], float)
self.assertEquals(table.types['ham'], datetime.date)
self.assertEquals(table.types['Monty'], datetime.datetime)
self.assertEquals(table.types['Python'], str)
示例8: test_should_indentify_type_datetime_correctly
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_should_indentify_type_datetime_correctly(self):
table = Table(headers=["Monty"])
table.append(["2010-11-15 02:42:01"])
table.append(["2011-11-20 21:05:59"])
table._identify_type_of_data()
self.assertEqual(table.types["Monty"], datetime.datetime)
示例9: test_should_indentify_type_date_correctly
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_should_indentify_type_date_correctly(self):
table = Table(headers=["Python"])
table.append(["2010-11-15"])
table.append(["2011-11-20"])
table._identify_type_of_data()
self.assertEqual(table.types["Python"], datetime.date)
示例10: test_should_indentify_type_float_correctly
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_should_indentify_type_float_correctly(self):
table = Table(headers=["ham"])
table.append([1.0])
table.append([3.14])
table._identify_type_of_data()
self.assertEqual(table.types["ham"], float)
示例11: test_should_indentify_type_int_correctly
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_should_indentify_type_int_correctly(self):
table = Table(headers=["spam"])
table.append([1])
table.append([2])
table._identify_type_of_data()
self.assertEqual(table.types["spam"], int)
示例12: test_should_indentify_type_str_when_only_headers_present
# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import _identify_type_of_data [as 别名]
def test_should_indentify_type_str_when_only_headers_present(self):
table = Table(headers=["eggs", "ham"])
table._identify_type_of_data()
self.assertEqual(table.types["eggs"], str)
self.assertEqual(table.types["ham"], str)