In Python3.8+, TypedDict is supported by PEP589, but not compatible in some cases. It breaks our tests as follows.
tests/test_base_client.py:16: in <module>
from centraldogma.exceptions import UnauthorizedException, NotFoundException
centraldogma/exceptions.py:166: in <module>
_EXCEPTION_FACTORIES: dict[str, Callable[[str], CentralDogmaException]] = {
E TypeError: 'type' object is not subscriptable
...
ERROR tests/test_base_client.py - TypeError: 'type' object is not subscriptable
ERROR tests/test_dogma.py - TypeError: 'type' object is not subscriptable
ERROR tests/test_exceptions.py - TypeError: 'type' object is not subscriptable
ERROR tests/integration/test_content_service.py - TypeError: 'type' object is not subscriptable
ERROR tests/integration/test_project_service.py - TypeError: 'type' object is not subscriptable
ERROR tests/integration/test_repository_service.py - TypeError: 'type' object is not subscriptable
Modifications
--
- Use `typing.Dict` instead of `dict` for typing.
Result
--
- `pytest` works as expected.
Motivation
TypedDict
is supported by PEP589, but not compatible in some cases. It breaks our tests as follows....
ERROR tests/test_base_client.py - TypeError: 'type' object is not subscriptable ERROR tests/test_dogma.py - TypeError: 'type' object is not subscriptable ERROR tests/test_exceptions.py - TypeError: 'type' object is not subscriptable ERROR tests/integration/test_content_service.py - TypeError: 'type' object is not subscriptable ERROR tests/integration/test_project_service.py - TypeError: 'type' object is not subscriptable ERROR tests/integration/test_repository_service.py - TypeError: 'type' object is not subscriptable