From b52eb8abcd6fe5a1965fbf9a9e4569aa81dc9287 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Fri, 13 Nov 2026 23:54:24 +0100 Subject: [PATCH] Import DateSpan from its module in DateSpanSet.to_span DateSpanSet.to_span imports DateSpan from pymeos/collections/time/datespan.py, the module defining it, and answers the DateSpan of the span set. Why. to_span imported DateSpan from .dateset, which defines DateSet alone, so every call raised ImportError: cannot import name 'DateSpan' from 'pymeos.collections.time.dateset'. Measured. On PyMEOS master 622ccd1, DateSpanSet("{[2019-09-08, 2019-09-10], [2019-09-12, 2019-09-14]}").to_span() raises that ImportError; this change answers DateSpan("[2019-09-08, 2019-09-14]"). Witness. tests/collections/time/datespanset_test.py gains test_to_span, beside the test_to_span of dateset_test.py, and passes; ruff check and ruff format pass. --- pymeos/collections/time/datespanset.py | 2 +- tests/collections/time/datespanset_test.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pymeos/collections/time/datespanset.py b/pymeos/collections/time/datespanset.py index 9159021f..95fb60b5 100644 --- a/pymeos/collections/time/datespanset.py +++ b/pymeos/collections/time/datespanset.py @@ -100,7 +100,7 @@ def to_span(self) -> DateSpan: MEOS Functions: spanset_span """ - from .dateset import DateSpan + from .datespan import DateSpan return DateSpan(_inner=super().to_span()) diff --git a/tests/collections/time/datespanset_test.py b/tests/collections/time/datespanset_test.py index 73f47d95..aa0b2d5f 100644 --- a/tests/collections/time/datespanset_test.py +++ b/tests/collections/time/datespanset_test.py @@ -34,6 +34,13 @@ def test_shift_scale_below_a_day(self, delta): value.scale(delta) +class TestDateSpanSetConversions(TestDateSpanSet): + # The span of a date span set, as #TestCollectionConversions.test_to_span of + # dateset_test.py checks the span of a date set + def test_to_span(self): + assert self.date_spanset.to_span() == DateSpan("[2019-09-08, 2019-09-14]") + + class TestDateSpanSetAccessors(TestDateSpanSet): # The dates of a date span set are the bounds of its spans, answered as a # list as #TestDateSetAccessors.test_elements answers the elements of a set