Skip to content

Conversation

@sinisaos
Copy link
Member

Related to this issue

@sinisaos sinisaos requested a review from dantownsend June 10, 2025 06:04
Comment on lines 17 to 22
self.assertIs(get_type(Optional[str]), str)
self.assertIs(get_type(Optional[list[str]]).__mro__, list[str].__mro__)
self.assertIs(get_type(Union[str, None]), str)

# Should be returned as is, because it's not optional:
self.assertIs(get_type(t.List[str]), t.List[str])
self.assertIs(get_type(list[str]).__mro__, list[str].__mro__)
Copy link
Member

Choose a reason for hiding this comment

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

I changed this slightly. Comparing __mro__ does work, but I was confused by it at first. I changed the assertions to assertEqual and this works instead.

@dantownsend
Copy link
Member

Looks great - thanks!

@dantownsend dantownsend merged commit 18d31ba into piccolo-orm:master Jun 10, 2025
11 checks passed
@sinisaos sinisaos deleted the improve_type_hints branch June 11, 2025 06:47
@sinisaos
Copy link
Member Author

@dantownsend Do you want me to make these changes to the targ repository as well? There aren't many files so there shouldn't be any problems.

@dantownsend
Copy link
Member

@dantownsend Do you want me to make these changes to the targ repository as well? There aren't many files so there shouldn't be any problems.

Yes, that would be great - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants