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

VS-1557: Allow unstructuring of attrs classes in typing.Any-typed fields #17

Merged
merged 2 commits into from
Nov 15, 2022

Conversation

xaviergmail
Copy link
Contributor

This fixes a regression in cattrs >= 1.2.0: python-attrs/cattrs#320. It is again a very naïve solution but fixes the regression here.

Comment on lines +1 to +19
from typecats import Cat, try_struc


def test_with_no_default():
@Cat
class Thing(dict):
name: str

assert try_struc(Thing, None) is None
assert Thing.try_struc(None) is None


def test_with_default():
@Cat
class Thing(dict):
name: str = ""

assert try_struc(Thing, None) is None
assert Thing.try_struc(None) is None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had this file leftover in my working tree from something in the past. It's not related to this PR but wouldn't hurt.

@danielxoi danielxoi merged commit 790eb75 into main Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants