本文整理匯總了Python中ovirtsdk4.reader.Reader.read_dates方法的典型用法代碼示例。如果您正苦於以下問題:Python Reader.read_dates方法的具體用法?Python Reader.read_dates怎麽用?Python Reader.read_dates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ovirtsdk4.reader.Reader
的用法示例。
在下文中一共展示了Reader.read_dates方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_read_dates_empty_list_without_close_tag
# 需要導入模塊: from ovirtsdk4.reader import Reader [as 別名]
# 或者: from ovirtsdk4.reader.Reader import read_dates [as 別名]
def test_read_dates_empty_list_without_close_tag():
"""
Test given no values without close tag returns empty list.
"""
io_buffer = make_buffer('<list/>')
xml_reader = XmlReader(io_buffer)
assert_equals(Reader.read_dates(xml_reader), [])
示例2: test_read_dates_with_one_value
# 需要導入模塊: from ovirtsdk4.reader import Reader [as 別名]
# 或者: from ovirtsdk4.reader.Reader import read_dates [as 別名]
def test_read_dates_with_one_value():
"""
Test given one value returns list containing one value.
"""
io_buffer = make_buffer(
'<list><value>2015-12-10T22:00:30+01:00</value></list>'
)
xml_reader = XmlReader(io_buffer)
date = datetime(2015, 12, 10, 22, 0, 30, tzinfo=TZ(60, None))
assert_equals(Reader.read_dates(xml_reader), [date])
示例3: test_read_dates_with_two_values
# 需要導入模塊: from ovirtsdk4.reader import Reader [as 別名]
# 或者: from ovirtsdk4.reader.Reader import read_dates [as 別名]
def test_read_dates_with_two_values():
"""
Test given two values returns list containing two values.
"""
io_buffer = make_buffer(
'<list>'
'<value>2015-12-10T22:00:30+01:00</value>'
'<value>2016-12-10T22:00:30+01:00</value>'
'</list>'
)
xml_reader = XmlReader(io_buffer)
date1 = datetime(2015, 12, 10, 22, 0, 30, tzinfo=TZ(60, None))
date2 = datetime(2016, 12, 10, 22, 0, 30, tzinfo=TZ(60, None))
assert_equals(Reader.read_dates(xml_reader), [date1, date2])