Skip to content

Conversation

@terencehonles
Copy link

  • Tests added: Please use assert_type() to assert the type of any return value

Copy link
Contributor

@cmp0xff cmp0xff left a comment

Choose a reason for hiding this comment

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

Hi @terencehonles , thank you for the proposal. Having checked the Pandas documentation, and it seems that data can indeed be an Iterator.

Comment on lines +159 to +163
check(
assert_type(pd.Series(iter([1.0])), "pd.Series[float]"),
pd.Series,
float,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Several __new__'s have been retyped, but only one test has been added. Please complete the new tests. Alternatively, you can split the old test function into two.

def __new__(
cls,
data: Sequence[_str],
data: Iterator[_str],
Copy link
Contributor

Choose a reason for hiding this comment

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

Iterator[_str] can be ambiguous, because _str is an Iterable in its own right. However, I don't have more insights how to improve this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use Iterator[SequenceNotStr[_str]]

@cmp0xff
Copy link
Contributor

cmp0xff commented Oct 9, 2025

Hi @terencehonles , would you be able to follow up on this?

@cmp0xff cmp0xff added the Constructors Series/DataFrame/Index/pd.array Constructors label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Constructors Series/DataFrame/Index/pd.array Constructors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants