Skip to content

Commit 3cb19bd

Browse files
committed
Address code coverage in tests
1 parent f8fa635 commit 3cb19bd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/nested_pandas/nestedframe/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ def reduce(self, func, *args, **kwargs) -> NestedFrame: # type: ignore[override
872872
Takes a function and applies it to each top-level row of the NestedFrame.
873873
874874
The user may specify which columns the function is applied to, with
875-
columns from the 'base' layer being passsed to the function as
875+
columns from the 'base' layer being passed to the function as
876876
scalars and columns from the nested layers being passed as numpy arrays.
877877
878878
Parameters

tests/nested_pandas/nestedframe/test_nestedframe.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,14 @@ def offset_avg(offset, col_to_avg, column_names):
870870
for i in range(len(result)):
871871
assert result["offset_avg"].values[i] == expected_offset_avg[i]
872872

873+
# Verify that we can understand a string argument to the reduce function,
874+
# so long as it isn't a column name.
875+
def make_id(col1, prefix_str):
876+
return f"{prefix_str}{col1}"
877+
878+
result = nf.reduce(make_id, "b", "some_id_")
879+
assert result[0][1] == "some_id_4"
880+
873881

874882
def test_reduce_duplicated_cols():
875883
"""Tests nf.reduce() to correctly handle duplicated column names."""

0 commit comments

Comments
 (0)