Skip to content

CountryAlpha2 class example use-case results in mypy error #316

Description

@TeaDrinkingProgrammer

When the documented example use-case of CountryAlpha2 is used with Mypy, it results in a type error.

Code:

from pydantic import BaseModel

from pydantic_extra_types.country import CountryAlpha2


class Product(BaseModel):
    made_in: CountryAlpha2


product = Product(made_in='ES')
print(product)
# > made_in='ES'

Results in:

Argument "made_in" to "Product" has incompatible type "str"; expected "CountryAlpha2" [arg-type]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions