Ejemplo n.º 1
0
def test_datetime_with_timezone():
    dt = sc.DateTimeType('2009-01-01T00:00:00+02:00')
    print dt
    assert dt.year == 2009
    assert dt.month == 1
    assert dt.day == 1
    assert dt.hour == 0
    assert dt.utcoffset()
    assert str(dt) == '2009-01-01T00:00:00+02:00'
Ejemplo n.º 2
0
def test_datetime_from_string():
    dt = sc.DateTimeType('2009-01-01T00:00:00')
    assert dt.year == 2009
    assert dt.month == 1
    assert dt.day == 1
    assert dt.hour == 0
    assert dt.minute == 0
    assert dt.second == 0
    assert not dt.microsecond
    assert str(dt) == '2009-01-01T00:00:00'
Ejemplo n.º 3
0
def test_datetime_from_element():
    e = etree.Element('WhatEver')
    e.text = '2009-01-01T00:00:00'
    dt = sc.DateTimeType(e)
    assert dt.year == 2009
    assert dt.month == 1
    assert dt.day == 1
    assert dt.hour == 0
    assert dt.minute == 0
    assert dt.second == 0
    assert not dt.microsecond
    assert not dt.utcoffset()
    assert str(dt) == '2009-01-01T00:00:00'