Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "retrack"
version = "3.3.2"
version = "3.3.3"
description = "A business rules engine"
authors = ["Gabriel Guarisa <[email protected]>"]
license = "MIT"
Expand Down
4 changes: 4 additions & 0 deletions retrack/nodes/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
14 changes: 14 additions & 0 deletions tests/test_nodes/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down