From 5777e2296c1d5abd19e0090c86cd1e800351ec6c Mon Sep 17 00:00:00 2001 From: Julian Vogel Date: Mon, 16 Sep 2024 15:16:06 +0200 Subject: [PATCH] model.datatypes: add test to copy and deepcopy a date --- test/model/test_datatypes.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/model/test_datatypes.py b/test/model/test_datatypes.py index be4666c28..8021414db 100644 --- a/test/model/test_datatypes.py +++ b/test/model/test_datatypes.py @@ -7,6 +7,7 @@ import datetime import math import unittest +import copy import dateutil @@ -177,6 +178,13 @@ def test_parse_partial_dates(self) -> None: model.datatypes.from_xsd("10-10", model.datatypes.GYearMonth) self.assertEqual("Value is not a valid XSD GYearMonth string", str(cm.exception)) + def test_copy_date(self) -> None: + date = model.datatypes.Date(2020, 1, 24) + date_copy_shallow = copy.copy(date) + self.assertEqual(date, date_copy_shallow) + date_copy_deep = copy.deepcopy(date) + self.assertEqual(date, date_copy_deep) + def test_serialize_partial_dates(self) -> None: self.assertEqual("2019", model.datatypes.xsd_repr(model.datatypes.GYear(2019))) self.assertEqual("2019Z", model.datatypes.xsd_repr(model.datatypes.GYear(2019, datetime.timezone.utc)))