From ce3e53651281ad701dd4392423eefc98ab7fbdf6 Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Tue, 25 Aug 2020 14:03:16 +0200 Subject: [PATCH] TST: Correct timezone in test, imporve millisecond test --- unittests/test_cfood.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unittests/test_cfood.py b/unittests/test_cfood.py index 27048865..54719993 100644 --- a/unittests/test_cfood.py +++ b/unittests/test_cfood.py @@ -34,7 +34,7 @@ from caosadvancedtools.crawler import FileCrawler from caosadvancedtools.example_cfood import ExampleCFood from caosdb.common.models import _parse_single_xml_element from lxml import etree -from datetime import datetime +from datetime import datetime, timezone PATTERN = "h.*" @@ -233,13 +233,13 @@ class InsertionTest(unittest.TestCase): 2020, 1, 1, 15, 0), to_be_updated=to_be_updated) assert len(to_be_updated) == 1 rec = _parse_single_xml_element(etree.fromstring( - entity_xml.format("2020-01-01T00:00:00.000"))) + entity_xml.format("2020-01-01T00:00:00.0"))) assure_has_property(entity=rec, name="TestDate", value=datetime( 2020, 1, 1), to_be_updated=to_be_updated) rec = _parse_single_xml_element(etree.fromstring( - entity_xml.format("2020-01-01T00:00:00.000+0100"))) + entity_xml.format("2020-01-01T00:00:00.000+0000"))) assure_has_property(entity=rec, name="TestDate", value=datetime( - 2020, 1, 1), to_be_updated=to_be_updated) + 2020, 1, 1, tzinfo=timezone.utc), to_be_updated=to_be_updated) assert len(to_be_updated) == 1 -- GitLab