From e05d1a74f70bc1d088d0c41807c49fbbd391c6f1 Mon Sep 17 00:00:00 2001 From: Gabriel Guarisa Date: Fri, 2 Jan 2026 16:05:18 -0300 Subject: [PATCH 1/6] Return empty Series for empty differences Handle case where differences are empty by returning an empty Series. --- retrack/nodes/datetime.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/retrack/nodes/datetime.py b/retrack/nodes/datetime.py index 80543df..533738a 100644 --- a/retrack/nodes/datetime.py +++ b/retrack/nodes/datetime.py @@ -87,6 +87,10 @@ def replace_invalid(value): timestamp_1 = input_value_1.apply(replace_invalid) differences = timestamp_1.sub(timestamp_0) + + if differences.empty: + return {"output_value": pd.Series()} + days = differences.dt.days return {"output_value": days} From f2df96840f6586a11997f6e9065b0f77d103e445 Mon Sep 17 00:00:00 2001 From: Gabriel Guarisa Date: Mon, 5 Jan 2026 10:10:24 -0300 Subject: [PATCH 2/6] bump version to 3.3.3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 63782ef..1662e58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "retrack" -version = "3.3.2" +version = "3.3.3" description = "A business rules engine" authors = ["Gabriel Guarisa "] license = "MIT" From 0ed70e60421fd1dd4608313c00a66f5bb88042fa Mon Sep 17 00:00:00 2001 From: Gabriel Guarisa Date: Mon, 5 Jan 2026 10:15:41 -0300 Subject: [PATCH 3/6] Add test for DifferenceBetweenDates with empty input Series --- retrack/nodes/datetime.py | 4 ++-- tests/test_nodes/test_datetime.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/retrack/nodes/datetime.py b/retrack/nodes/datetime.py index 533738a..8b1c20f 100644 --- a/retrack/nodes/datetime.py +++ b/retrack/nodes/datetime.py @@ -88,8 +88,8 @@ def replace_invalid(value): differences = timestamp_1.sub(timestamp_0) - if differences.empty: - return {"output_value": pd.Series()} + # if differences.empty: + # return {"output_value": pd.Series()} days = differences.dt.days diff --git a/tests/test_nodes/test_datetime.py b/tests/test_nodes/test_datetime.py index 6e8ba6b..54115d1 100644 --- a/tests/test_nodes/test_datetime.py +++ b/tests/test_nodes/test_datetime.py @@ -186,6 +186,20 @@ def now(cls, tz=None): assert (output["output_value"] == pd.Series([30, -30])).all() +@pytest.mark.asyncio +async def test_difference_between_dates_node_run_with_empty_series( + difference_between_dates_input_data, +): + difference_between_dates_node = DifferenceBetweenDates( + **difference_between_dates_input_data + ) + + output = await difference_between_dates_node.run(pd.Series(), pd.Series()) + + assert isinstance(output["output_value"], pd.Series) + assert output["output_value"].empty + + @pytest.fixture def to_iso_format_input_data(): return { From b18ea3dcbc72f307c3c755a4a13f7d7e3a04f745 Mon Sep 17 00:00:00 2001 From: Gabriel Guarisa Date: Mon, 5 Jan 2026 10:16:55 -0300 Subject: [PATCH 4/6] Return empty Series for empty differences in DifferenceBetweenDates --- retrack/nodes/datetime.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retrack/nodes/datetime.py b/retrack/nodes/datetime.py index 8b1c20f..533738a 100644 --- a/retrack/nodes/datetime.py +++ b/retrack/nodes/datetime.py @@ -88,8 +88,8 @@ def replace_invalid(value): differences = timestamp_1.sub(timestamp_0) - # if differences.empty: - # return {"output_value": pd.Series()} + if differences.empty: + return {"output_value": pd.Series()} days = differences.dt.days From 6dd957ecf3c2fbb006ce46535e3c87334594a9f3 Mon Sep 17 00:00:00 2001 From: Gabriel Guarisa Date: Mon, 5 Jan 2026 10:25:27 -0300 Subject: [PATCH 5/6] Bump version to 3.3.3a1 in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1662e58..b1faf03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "retrack" -version = "3.3.3" +version = "3.3.3a1" description = "A business rules engine" authors = ["Gabriel Guarisa "] license = "MIT" From 0ef12a4d04595b46993b7ef3b5a81d2a88aa01dd Mon Sep 17 00:00:00 2001 From: Gabriel Guarisa Date: Mon, 5 Jan 2026 10:27:34 -0300 Subject: [PATCH 6/6] Bump version to 3.3.3 in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b1faf03..1662e58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "retrack" -version = "3.3.3a1" +version = "3.3.3" description = "A business rules engine" authors = ["Gabriel Guarisa "] license = "MIT"