Beispiel #1
0
 def test_datetime(self):
     d = DateTime()
     n = datetime.datetime.now()
     element = DateTime.to_xml(n)
     self.assertEquals(element.text, n.isoformat())
     dt = DateTime.from_xml(element)
     self.assertEquals(n, dt)
Beispiel #2
0
 def test_datetime(self):
     d = DateTime()
     n = datetime.datetime.now()
     element = DateTime.to_xml(n)
     self.assertEquals(element.text, n.isoformat())
     dt = DateTime.from_xml(element)
     self.assertEquals(n, dt)
Beispiel #3
0
    def test_datetime(self):
        d = DateTime()
        n = datetime.datetime.now()

        element = etree.Element('test')
        DateTime.to_xml(n, ns_test, element)
        element = element[0]

        self.assertEquals(element.text, n.isoformat())
        dt = DateTime.from_xml(element)
        self.assertEquals(n, dt)
Beispiel #4
0
    def test_utcdatetime(self):
        datestring = '2007-05-15T13:40:44Z'
        e = create_xml_element('test', ns)
        e.text = datestring

        dt = DateTime.from_xml(e)

        self.assertEquals(dt.year, 2007)
        self.assertEquals(dt.month, 5)
        self.assertEquals(dt.day, 15)

        datestring = '2007-05-15T13:40:44.003Z'
        e = create_xml_element('test', ns)
        e.text = datestring

        dt = DateTime.from_xml(e)

        self.assertEquals(dt.year, 2007)
        self.assertEquals(dt.month, 5)
        self.assertEquals(dt.day, 15)
Beispiel #5
0
    def test_utcdatetime(self):
        datestring = '2007-05-15T13:40:44Z'
        e = create_xml_element('test', ns)
        e.text = datestring

        dt = DateTime.from_xml(e)

        self.assertEquals(dt.year, 2007)
        self.assertEquals(dt.month, 5)
        self.assertEquals(dt.day, 15)

        datestring = '2007-05-15T13:40:44.003Z'
        e = create_xml_element('test', ns)
        e.text = datestring

        dt = DateTime.from_xml(e)

        self.assertEquals(dt.year, 2007)
        self.assertEquals(dt.month, 5)
        self.assertEquals(dt.day, 15)