From 209fda56206b245ced3eee149dd843eb556166b7 Mon Sep 17 00:00:00 2001 From: amercader Date: Thu, 6 Jun 2024 12:56:59 +0200 Subject: [PATCH] [#56] Fix dates tests --- .../test_euro_dcatap_2_profile_serialize.py | 4 ++-- .../test_euro_dcatap_profile_serialize.py | 4 ++-- ckanext/dcat/tests/test_scheming_support.py | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ckanext/dcat/tests/test_euro_dcatap_2_profile_serialize.py b/ckanext/dcat/tests/test_euro_dcatap_2_profile_serialize.py index 114dc602..abf80363 100644 --- a/ckanext/dcat/tests/test_euro_dcatap_2_profile_serialize.py +++ b/ckanext/dcat/tests/test_euro_dcatap_2_profile_serialize.py @@ -298,13 +298,13 @@ def test_temporal(self): for predicate in [SCHEMA.startDate, DCAT.startDate]: triples = [] for temporal_obj in temporal_obj_list: - triples.extend(self._triples(g, temporal_obj, predicate, parse_date(extras['temporal_start']).isoformat(), XSD.dateTime)) + triples.extend(self._triples(g, temporal_obj, predicate, extras['temporal_start'], XSD.dateTime)) assert len(triples) == 1 for predicate in [SCHEMA.endDate, DCAT.endDate]: triples = [] for temporal_obj in temporal_obj_list: - triples.extend(self._triples(g, temporal_obj, predicate, parse_date(extras['temporal_end']).isoformat(), XSD.dateTime)) + triples.extend(self._triples(g, temporal_obj, predicate, extras['temporal_end'], XSD.date)) assert len(triples) == 1 def test_high_value_datasets(self): diff --git a/ckanext/dcat/tests/test_euro_dcatap_profile_serialize.py b/ckanext/dcat/tests/test_euro_dcatap_profile_serialize.py index bfed0160..edec0c5a 100644 --- a/ckanext/dcat/tests/test_euro_dcatap_profile_serialize.py +++ b/ckanext/dcat/tests/test_euro_dcatap_profile_serialize.py @@ -503,8 +503,8 @@ def test_temporal(self): assert temporal assert self._triple(g, temporal, RDF.type, DCT.PeriodOfTime) - assert self._triple(g, temporal, SCHEMA.startDate, parse_date(extras['temporal_start']).isoformat(), XSD.dateTime) - assert self._triple(g, temporal, SCHEMA.endDate, parse_date(extras['temporal_end']).isoformat(), XSD.dateTime) + assert self._triple(g, temporal, SCHEMA.startDate, extras['temporal_start'], XSD.dateTime) + assert self._triple(g, temporal, SCHEMA.endDate, extras['temporal_end'], XSD.date) def test_spatial(self): dataset = { diff --git a/ckanext/dcat/tests/test_scheming_support.py b/ckanext/dcat/tests/test_scheming_support.py index 38e4da4d..9fd124a5 100644 --- a/ckanext/dcat/tests/test_scheming_support.py +++ b/ckanext/dcat/tests/test_scheming_support.py @@ -201,15 +201,15 @@ def test_e2e_ckan_to_dcat(self): g, dataset_ref, DCT.issued, - dataset["issued"] + "T00:00:00", - data_type=XSD.dateTime, + dataset["issued"], + data_type=XSD.date, ) assert self._triple( g, dataset_ref, DCT.modified, - dataset["modified"] + "T00:00:00", - data_type=XSD.dateTime, + dataset["modified"], + data_type=XSD.date, ) # List fields @@ -307,29 +307,29 @@ def test_e2e_ckan_to_dcat(self): g, temporal[0][2], SCHEMA.startDate, - dataset_dict["temporal_coverage"][0]["start"] + "T00:00:00", - data_type=XSD.dateTime, + dataset_dict["temporal_coverage"][0]["start"], + data_type=XSD.date, ) assert self._triple( g, temporal[0][2], SCHEMA.endDate, - dataset_dict["temporal_coverage"][0]["end"] + "T00:00:00", - data_type=XSD.dateTime, + dataset_dict["temporal_coverage"][0]["end"], + data_type=XSD.date, ) assert self._triple( g, temporal[1][2], SCHEMA.startDate, - dataset_dict["temporal_coverage"][1]["start"] + "T00:00:00", - data_type=XSD.dateTime, + dataset_dict["temporal_coverage"][1]["start"], + data_type=XSD.date, ) assert self._triple( g, temporal[1][2], SCHEMA.endDate, - dataset_dict["temporal_coverage"][1]["end"] + "T00:00:00", - data_type=XSD.dateTime, + dataset_dict["temporal_coverage"][1]["end"], + data_type=XSD.date, ) spatial = [t for t in g.triples((dataset_ref, DCT.spatial, None))]