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 list of literal generation (#239) #240

Merged
merged 1 commit into from
Jun 25, 2023

Conversation

Simske
Copy link
Contributor

@Simske Simske commented Jun 25, 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

Description

The issue described in #239 is fixed in this PR. The issue arises, because the generation of Literal field is handled directly in polyfactory.factories.base.BaseFactory.get_field_value(), but generating for a collection type uses polyfactory.value_generators.complex_types.handle_complex_type().

The fix adds the handling for literals to that function, but this creates a bit of code duplication. The better way would probably be to move the code for handling literals into a separate function, but I don't know the code structure well enough, so I'm open to suggestions.

Close Issue(s)

Closes #239

@Simske Simske marked this pull request as ready for review June 25, 2023 15:14
@Simske Simske requested a review from a team as a code owner June 25, 2023 15:14
@Goldziher Goldziher merged commit 01ba280 into litestar-org:main Jun 25, 2023
4 of 12 checks passed
@Goldziher
Copy link
Contributor

@all-contributors add @Simske code

@allcontributors
Copy link
Contributor

@Goldziher

I've put up a pull request to add @Simske! 🎉

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: List[Literal[..]] throws TypeError
2 participants