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

chore(tests): Add basic test for litestar example #148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sherbang
Copy link

@sherbang sherbang commented Mar 26, 2024

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
  • [ x ] Pre-Commit Checks were ran and passed
  • Tests were ran and passed

Description

  • Add test for litestar example

This test was developed to test, and is currently failing due to #147. It seems like it would also be useful in the future to make sure that the documented example is kept up to date.

Close Issue(s)

@sherbang sherbang requested review from a team as code owners March 26, 2024 16:10
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @sherbang - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 3 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Docstrings: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

tests/examples/test_litestar.py Show resolved Hide resolved
tests/examples/test_litestar.py Outdated Show resolved Hide resolved
tests/examples/test_litestar.py Outdated Show resolved Hide resolved
@cofin cofin changed the title test: Add basic test for litestar example chore(tests): Add basic test for litestar example Mar 26, 2024
@cofin
Copy link
Member

cofin commented Mar 26, 2024

Thanks for the additional tests.

To make this work on 3.8 we'll have to update the hints used in the example file. Alternately, we could limit this test to only run in the main environment if we didn't want to update the type hints.

I'm good with either solution on this.

Thanks again!

@sherbang
Copy link
Author

The litestar example was quite broken. The pydantic models were not able to handle the UUID type from uuid_utils.

I noticed a comment in here about using pydantic models to not add confusion with DTOs, but I think that's only true for someone who is very proficient with Pydantic. There was quite a lot of code that was just converting between model types. To me, this code seems simpler, and DTOs are a good concept to learn if working with Litestar. However, I've pulled out a lot of hair in the past getting Pydantic to properly handle custom types in the past, so adding that would definitely push the Pydantic version over the edge in terms of being more complex.

I'll address the python 3.8 type annotation issue tomorrow. I expect I'll take the option of limiting this test to only run on main, I just need to figure out how to do that.

@sherbang sherbang force-pushed the litestar_test branch 2 times, most recently from 2572d66 to cba4f5f Compare March 27, 2024 13:43
examples/litestar.py Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Apr 5, 2024

Documentation preview will be available shortly at https://jolt-org.github.io/advanced-alchemy-docs-preview/148

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.

None yet

2 participants