From 490e3d27d529cbd6f079147be883cb94f0da4ff9 Mon Sep 17 00:00:00 2001 From: Plamen Neykov Date: Thu, 13 Mar 2025 22:36:04 +0000 Subject: [PATCH] added some rudimentary cardinality checks --- test/serializer-round-trip/test_conditions.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/serializer-round-trip/test_conditions.py diff --git a/test/serializer-round-trip/test_conditions.py b/test/serializer-round-trip/test_conditions.py new file mode 100644 index 0000000..c4fef7b --- /dev/null +++ b/test/serializer-round-trip/test_conditions.py @@ -0,0 +1,28 @@ +# pylint: disable=invalid-name +'''testing basic conditions compliance''' +import datetime +import pytest +from pydantic import Field, ValidationError +from rune.runtime.base_data_class import BaseDataClass + + +class cdm_base_datetime_DateList(BaseDataClass): + """ + List of dates. + """ + _FQRTN = 'cdm.base.datetime.DateList' + date: list[datetime.date] = Field(..., description='', min_length=1) + + +def test_min_list_length_all_defaults(): + '''no doc''' + with pytest.raises(ValidationError): + cdm_base_datetime_DateList() + + +def test_min_list_length_empty_list(): + '''no doc''' + with pytest.raises(ValidationError): + cdm_base_datetime_DateList(date=[]) + +# EOF