Closed norabelrose closed 1 year ago
Hey there @norabelrose, thanks for making this!
You're right that this would ideally require a test. I'll get back to you with an example of what that could look like, but in the meantime, you could probably take a look at this:
The goal of the tests would be to:
If you feel like taking a swing at this, let me know. If not, no worries! :) Let me know what you think.
All right let me take a look at the tests
Hmmm I'm actually not able to replicate the bug anymore? Not sure what's going on
Nvm now I'm seeing the bug again
Just added a test; should fix #226
On
master
, you can't deserialize a dataclass withLiteral
type annotations without running into warnings like this:I've fixed this by adding an extra if-block in
helpers/serialization/decoders.py
that checks for Literal types:The Callables created by the
decode_literal
function simply check if the input values are among those permitted by the Literal type, and raise aTypeError
if so.Please let me know if there's anything else I need to do (e.g. add a test?) to make this PR mergeable.