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

transmuted value is not an instance of the annotation after subclass? #58

Closed
xbanke opened this issue Apr 25, 2020 · 3 comments · Fixed by #59
Closed

transmuted value is not an instance of the annotation after subclass? #58

xbanke opened this issue Apr 25, 2020 · 3 comments · Fixed by #59
Assignees
Labels
bug Something isn't working

Comments

@xbanke
Copy link

xbanke commented Apr 25, 2020

  • typical version: 2.0.2
  • Python version: 3.7.4
  • Operating System:

Description

@seandstewart , is this a bug?

import typic

@typic.klass
class Foo:
    foo: str


@typic.klass
class FooBar(Foo):
    bar: str


isinstance(Foo.transmute({'foo': 'foo'}), Foo)  # True
isinstance(FooBar.transmute({'foo': 'foo', 'bar': 'bar'}), FooBar)  # False
@seandstewart
Copy link
Owner

It most definitely is. This was a tricky bug - but as a result I've got a fix which also cleans up the resulting MRO as well. I'll publish a release with a fix later today.

@seandstewart seandstewart self-assigned this Apr 25, 2020
@seandstewart seandstewart added the bug Something isn't working label Apr 25, 2020
seandstewart added a commit that referenced this issue Apr 25, 2020
@seandstewart
Copy link
Owner

This is fixed in v2.0.3, which has been published to PyPI.

@xbanke
Copy link
Author

xbanke commented Apr 26, 2020

Thanks for quick fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants