当前位置: 首页>>代码示例>>Python>>正文


Python Table._identify_type_of_data方法代码示例

本文整理汇总了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)
开发者ID:rennerocha,项目名称:outputty,代码行数:9,代码来源:test_Table_datatypes.py

示例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)
开发者ID:alextercete,项目名称:outputty,代码行数:10,代码来源:test_Table_datatypes.py

示例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)
开发者ID:rennerocha,项目名称:outputty,代码行数:12,代码来源:test_Table_datatypes.py

示例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)
开发者ID:rennerocha,项目名称:outputty,代码行数:12,代码来源:test_Table_datatypes.py

示例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)
开发者ID:alextercete,项目名称:outputty,代码行数:12,代码来源:test_Table_datatypes.py

示例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)
开发者ID:alextercete,项目名称:outputty,代码行数:13,代码来源:test_Table_datatypes.py

示例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)
开发者ID:alextercete,项目名称:outputty,代码行数:13,代码来源:test_Table_datatypes.py

示例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)
开发者ID:rennerocha,项目名称:outputty,代码行数:8,代码来源:test_Table_datatypes.py

示例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)
开发者ID:rennerocha,项目名称:outputty,代码行数:8,代码来源:test_Table_datatypes.py

示例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)
开发者ID:rennerocha,项目名称:outputty,代码行数:8,代码来源:test_Table_datatypes.py

示例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)
开发者ID:rennerocha,项目名称:outputty,代码行数:8,代码来源:test_Table_datatypes.py

示例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)
开发者ID:rennerocha,项目名称:outputty,代码行数:7,代码来源:test_Table_datatypes.py


注:本文中的outputty.Table._identify_type_of_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。