Skip to content
Merged
Changes from 1 commit
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
17 changes: 16 additions & 1 deletion tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,22 @@ def test_types_itertuples() -> None:
)

for t1 in df.itertuples():
check(assert_type(t1, _PandasNamedTuple), _PandasNamedTuple)
assert_type(t1, _PandasNamedTuple)
assert t1.__class__.__name__ == "Pandas"
assert isinstance(t1.Index, int)
assert isinstance(t1.col1, int)
assert isinstance(t1.col2, int)
for k in [0, 1]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop and the one below should be for k in [0,1,2] since the tuple has 3 components.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh yes correct I thought it was iterating over the number of elements.

assert isinstance(t1[k], int)

for t1 in df.itertuples(name="FooBar"):
assert_type(t1, _PandasNamedTuple)
assert t1.__class__.__name__ == "FooBar"
assert isinstance(t1.Index, int)
assert isinstance(t1.col1, int)
assert isinstance(t1.col2, int)
for k in [0, 1]:
assert isinstance(t1[k], int)


def test_types_items() -> None:
Expand Down