Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #366: Fix Union[str, List[str]] #381

Conversation

mdczaplicki
Copy link
Contributor

@mdczaplicki mdczaplicki commented Sep 19, 2023

Pull Request Checklist

  • New code has 100% test coverage
  • (If applicable) The prose documentation has been updated to reflect the changes introduced by this PR
  • (If applicable) The reference documentation has been updated to reflect the changes introduced by this PR
  • Pre-Commit Checks were ran and passed
  • Tests were ran and passed

Description

Close Issue(s)

@mdczaplicki mdczaplicki requested review from a team as code owners September 19, 2023 20:39
@mdczaplicki mdczaplicki changed the title #366: Fix Union[str, List[str]] fix: #366: Fix Union[str, List[str]] Sep 19, 2023
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -18,12 +18,12 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.286"
rev: "v0.0.290"
Copy link
Member

Choose a reason for hiding this comment

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

It might be a good idea to split these changes into a new PR.


def test_union_str_and_list() -> None:
class A(BaseModel):
a: Union[str, List[str]]
Copy link
Member

Choose a reason for hiding this comment

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

I would also add a test case for str | list[str] with __future__ import.

@guacs
Copy link
Member

guacs commented Sep 22, 2023

@mdczaplicki thanks for this fix :)

A few points:

  • could you separate the fix and pre-commit upgrades into separate PRs as suggested by @sobolevn?
  • could you resolve the failing tests?

@guacs
Copy link
Member

guacs commented Oct 8, 2023

@mdczaplicki Any updates?

@guacs
Copy link
Member

guacs commented Jan 19, 2024

Closing due to #366 being fixed in #468.

@guacs guacs closed this Jan 19, 2024
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.

Bug: Broken union type generation since "polyfactory<2.6" (pydantic_factory)
4 participants