def testTranslatePythonObjectToString_failed(self, source): assert XDateTime.translate(source, topython=False) is source
def testTranslateStringToPythonObject(self): dt = datetime.datetime(1941, 12, 7, 10, 30, 22, 454000) assert XDateTime.translate("1941-12-7T10:30:22.454") == dt
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"
def testTranslateEmptyStringToPythonObject(self): assert XDateTime.translate("") == None