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

Default values just don't work #34

Closed
real-or-random opened this issue Mar 14, 2024 · 1 comment
Closed

Default values just don't work #34

real-or-random opened this issue Mar 14, 2024 · 1 comment

Comments

@real-or-random
Copy link

This example, taken literally from the README, fails on Python 3.11.8:

from typing import List
from chili import Decoder, decodable

@decodable
class Book:
    name: str
    author: str
    isbn: str = "1234567890"
    tags: List[str] = []

book_data = {"name": "The Hobbit", "author": "J.R.R. Tolkien"}
decoder = Decoder[Book]()

book = decoder.decode(book_data)

assert book.tags == []
assert book.isbn == "1234567890"

with

  File "<stdin>", line 1, in <module>
  File "[...]]/python3.11/site-packages/chili/decoder.py", line 599, in decode
    raise DecoderError.missing_property(key=key)
chili.error.DecoderError@missing_property: key=isbn
@real-or-random
Copy link
Author

Nevermind, it's a duplicate of #32...

@real-or-random real-or-random closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2024
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

No branches or pull requests

1 participant