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

[BUG] Functions in LetterCase aren't members of the enum #544

Open
benberryallwood opened this issue Sep 6, 2024 · 0 comments
Open

[BUG] Functions in LetterCase aren't members of the enum #544

benberryallwood opened this issue Sep 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@benberryallwood
Copy link

benberryallwood commented Sep 6, 2024

Description

The attributes in the LetterCase enum are functions, so they're being registered as methods rather than enum members.

Mypy doesn't recognise this as an issue, but Pyright shows errors when trying to do, e.g., @dataclass_json(letter_case=LetterCase.CAMEL):

Argument of type "(string: Unknown) -> (Unknown | Literal[''])" cannot be assigned to parameter "letter_case" of type "LetterCase | None" in function "dataclass_json"   Type "(string: Unknown) -> (Unknown | Literal[''])" is not assignable to type "LetterCase | None"     "function" is not assignable to "LetterCase"     "function" is not assignable to "None"

Code snippet that reproduces the issue

from dataclasses_json import LetterCase

assert isinstance(LetterCase.CAMEL, LetterCase)

Describe the results you expected

LetterCase.CAMEL should be an instance of LetterCase, so this assertion should pass

Python version you are using

Python 3.10.13

Environment description

attrs==23.1.0
black==22.12.0
certifi==2023.7.22
charset-normalizer==3.2.0
click==8.1.7
coverage==7.2.7
docstring-parser==0.15
exceptiongroup==1.1.3
falcon==2.0.0
flake8==5.0.4
ghp-import==2.1.0
gitdb==4.0.10
GitPython==3.1.32
hug==2.6.1
hypothesis==6.79.4
idna==3.4
importlib-metadata==4.2.0
iniconfig==2.0.0
Jinja2==3.1.2
livereload==2.6.3
Mako==1.2.4
Markdown==3.3.4
MarkupSafe==2.1.3
marshmallow==3.19.0
mccabe==0.7.0
mergedeep==1.3.4
mkdocs==1.2.4
mkdocs-material==7.3.0
mkdocs-material-extensions==1.1.1
mypy==1.4.1
mypy-extensions==1.0.0
packaging==23.1
pathspec==0.11.2
pdocs==1.2.0
platformdirs==3.10.0
pluggy==1.2.0
portray==1.7.0
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.16.1
pymdown-extensions==7.1
pytest==7.4.0
pytest-cov==2.12.1
python-dateutil==2.8.2
PyYAML==6.0.1
pyyaml_env_tag==0.1
requests==2.31.0
simplejson==3.19.1
six==1.16.0
smmap==5.0.0
sortedcontainers==2.4.0
toml==0.10.2
tomli==2.0.1
tornado==6.2
typing-inspect==0.9.0
typing_extensions==4.7.1
urllib3==2.0.4
watchdog==3.0.0
yaspin==0.15.0
zipp==3.15.0
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

No branches or pull requests

1 participant