From 3c8b6e916c29e105d6853983362bee43230b8ecf Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Tue, 20 Aug 2024 15:02:44 +0200 Subject: [PATCH] TST: Add unittest for https://gitlab.com/linkahead/linkahead-pylib/-/issues/128 --- unittests/test_issues.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/unittests/test_issues.py b/unittests/test_issues.py index 7472f710..a102b282 100644 --- a/unittests/test_issues.py +++ b/unittests/test_issues.py @@ -24,6 +24,7 @@ import os import lxml import linkahead as db +from datetime import date, datetime from pytest import raises @@ -64,3 +65,26 @@ def test_issue_156(): # </ParentList> assert value is project assert parents[0].name == "RTName" + + +def test_issue_128(): + """Test assigning datetime.date(time) values to DATETIME + properties: + https://gitlab.com/linkahead/linkahead-pylib/-/issues/128. + + """ + prop = db.Property(name="TestDatetime", datatype=db.DATETIME) + prop_list = db.Property(name="TestListDatetime", datatype=db.LIST(db.DATETIME)) + + today = date.today() + now = datetime.now() + + prop.value = today + assert prop.value == today + prop.value = now + assert prop.value == now + + prop_list.value = [today, today] + assert prop_list.value == [today, today] + prop_list.value = [now, now] + assert prop_list.value == [now, now] -- GitLab