本文整理汇总了Python中timeseries.TimeSeries._as_element方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries._as_element方法的具体用法?Python TimeSeries._as_element怎么用?Python TimeSeries._as_element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timeseries.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries._as_element方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_200
# 需要导入模块: from timeseries import TimeSeries [as 别名]
# 或者: from timeseries.TimeSeries import _as_element [as 别名]
def test_200(self):
'represent empty TimeSeries as Element'
obj = TimeSeries(location_id='loc', parameter_id='par')
current = obj._as_element()
self.assertTrue(isinstance(current, ElementTree.Element))
self.assertEquals('series', current.tag)
childElements = [i for i in current.getchildren()]
self.assertEquals(1, len(childElements))
self.assertEquals(['header'], [i.tag for i in childElements])
self.assertEquals({}, current.attrib)
示例2: test_201
# 需要导入模块: from timeseries import TimeSeries [as 别名]
# 或者: from timeseries.TimeSeries import _as_element [as 别名]
def test_201(self):
'represent TimeSeries with two events as Element'
obj = TimeSeries(location_id='loc', parameter_id='par')
obj[datetime(1980, 11, 23, 19, 35)] = -1
current = obj._as_element()
self.assertTrue(isinstance(current, ElementTree.Element))
self.assertEquals('series', current.tag)
childElements = [i for i in current.getchildren()]
self.assertEquals(2, len(childElements))
self.assertEquals(['header', 'event'],
[i.tag for i in childElements])
self.assertEquals({}, current.attrib)