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


Python Table.normalize_types方法代码示例

本文整理汇总了Python中outputty.Table.normalize_types方法的典型用法代码示例。如果您正苦于以下问题:Python Table.normalize_types方法的具体用法?Python Table.normalize_types怎么用?Python Table.normalize_types使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在outputty.Table的用法示例。


在下文中一共展示了Table.normalize_types方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_running_identify_data_type_with_normalized_types_should_return_correct_results

# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import normalize_types [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

示例2: test_normalize_types_should_convert_types_correctly

# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import normalize_types [as 别名]
 def test_normalize_types_should_convert_types_correctly(self):
     table = Table(headers=["spam", "eggs", "ham", "Monty", "Python"])
     table.append(["1", "2.71", "2011-01-01", "2011-01-01 02:03:04", "asd"])
     table.append([None, None, None, None, None])
     table.append([None, None, None, None, 42])
     table.normalize_types()
     self.assertEquals(table[0][0], 1)
     self.assertEquals(table[0][1], 2.71)
     self.assertEquals(table[0][2], datetime.date(2011, 1, 1))
     self.assertEquals(table[0][3], datetime.datetime(2011, 1, 1, 2, 3, 4))
     self.assertEquals(table[0][4], "asd")
开发者ID:rennerocha,项目名称:outputty,代码行数:13,代码来源:test_Table_datatypes.py

示例3: test_normalize_types_should_convert_types_correctly

# 需要导入模块: from outputty import Table [as 别名]
# 或者: from outputty.Table import normalize_types [as 别名]
 def test_normalize_types_should_convert_types_correctly(self):
     table = Table(headers=['spam', 'eggs', 'ham', 'Monty', 'Python'])
     table.append(['1', '2.71', '2011-01-01', '2011-01-01 02:03:04',
                        'asd'])
     table.append([None, None, None, None, None])
     table.append([None, None, None, None, 42])
     table.normalize_types()
     self.assertEquals(table[0][0], 1)
     self.assertEquals(table[0][1], 2.71)
     self.assertEquals(table[0][2], datetime.date(2011, 1, 1))
     self.assertEquals(table[0][3],
                       datetime.datetime(2011, 1, 1, 2, 3, 4))
     self.assertEquals(table[0][4], 'asd')
开发者ID:alextercete,项目名称:outputty,代码行数:15,代码来源:test_Table_datatypes.py


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