Exemplo n.º 1
0
 def testTranslatePythonObjectToString_failed(self, source):
     assert XDateTime.translate(source, topython=False) is source
Exemplo n.º 2
0
 def testTranslateStringToPythonObject(self):
     dt = datetime.datetime(1941, 12, 7, 10, 30, 22, 454000)
     assert XDateTime.translate("1941-12-7T10:30:22.454") == dt
Exemplo n.º 3
0
 def testTranslatePythonObjectToString(self):
     dt = datetime.datetime(2021, 12, 31, 11, 25, tzinfo=UtcTimezone())
     translated = XDateTime.translate(dt, topython=False)
     assert isinstance(translated, str)
     assert translated == "2021-12-31T11:25:00+00:00"
Exemplo n.º 4
0
 def testTranslateEmptyStringToPythonObject(self):
     assert XDateTime.translate("") == None
Exemplo n.º 5
0
 def testTranslatePythonObjectToString_failed(self, source):
     assert XDateTime.translate(source, topython=False) is source
Exemplo n.º 6
0
 def testTranslatePythonObjectToString(self):
     dt = datetime.datetime(2021, 12, 31, 11, 25, tzinfo=UtcTimezone())
     translated = XDateTime.translate(dt, topython=False)
     assert isinstance(translated, str)
     assert translated == "2021-12-31T11:25:00+00:00"
Exemplo n.º 7
0
 def testTranslateStringToPythonObject(self):
     dt = datetime.datetime(1941, 12, 7, 10, 30, 22, 454000)
     assert XDateTime.translate("1941-12-7T10:30:22.454") == dt
Exemplo n.º 8
0
 def testTranslateEmptyStringToPythonObject(self):
     assert XDateTime.translate("") == None