-
Notifications
You must be signed in to change notification settings - Fork 20
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 issue when a model has a Literal #49
Conversation
A `Literal` is special in that the argument to the literal is the actual collection of exact values that are permissible to that field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! One comment regarding an expected test failure when I enable the CI for this PR.
It'd be great if you can also add a test case. Either to https://github.com/drivendataorg/erdantic/blob/main/tests/test_typing.py |
@swails Thanks for working on this, it is affecting me too |
Test case added. |
I finally broke down and installed a local python 3.6 interpreter and fixed the tests locally. |
Thanks for your patience in getting through this. This is the first time GitHub's forced me to approve the GitHub Actions run on every update to the PR, and I think maybe there's some investigation for me to do on a better security–convenience balance in the settings. Also thanks for your patience in dealing with Python 3.6. We're probably overdue on dropping support for it, so sorry for the extra work that has caused you. |
Codecov Report
@@ Coverage Diff @@
## main #49 +/- ##
=======================================
- Coverage 98.0% 97.6% -0.4%
=======================================
Files 13 13
Lines 504 514 +10
=======================================
+ Hits 494 502 +8
- Misses 10 12 +2
|
If I read the message right, then once my first PR has been merged, PRs I raise after that will run automatically. But it looks like all of the tests have now passed! Let me know if there's anything else you want before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you for finding this issue and fixing.
A
Literal
is special in that the argument to the literal is the actualcollection of exact values that are permissible to that field.
Bug description. Start with a file named
erdbug.py
with the following contents:If we run the following command:
We get the following error:
The problem is that it's trying to evaluate the value passed to the
Literal
as a forward reference if it's a string, when in realityLiteral
is a special typing utility to indicate that the variable carries a specific value.After this PR, the following diagram is generated: