Skip to content

Commit 066ace9

Browse files
authored
Fix up missing coverage (#497)
1 parent d69cc96 commit 066ace9

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

HISTORY.md

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ can now be used as decorators and have gained new features.
5050
- `typing_extensions.Any` is now supported and handled like `typing.Any`.
5151
([#488](https://github.com/python-attrs/cattrs/issues/488) [#490](https://github.com/python-attrs/cattrs/pull/490))
5252
- The BaseConverter now properly generates detailed validation errors for mappings.
53+
([#496](https://github.com/python-attrs/cattrs/pull/496))
5354
- [PEP 695](https://peps.python.org/pep-0695/) generics are now tested.
5455
([#452](https://github.com/python-attrs/cattrs/pull/452))
5556
- Imports are now sorted using Ruff.

src/cattrs/converters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ def _find_type_alias_structure_hook(self, type: Any) -> StructureHook:
692692
res = self.get_structure_hook(base)
693693
if res == self._structure_call:
694694
# we need to replace the type arg of `structure_call`
695-
return lambda v, _, __base=base: self._structure_call(v, __base)
695+
return lambda v, _, __base=base: __base(v)
696696
return lambda v, _, __base=base: res(v, __base)
697697

698698
def _structure_final_factory(self, type):

tests/test_dicts.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from typing import Any, Dict
2+
3+
4+
def test_any_keys(converter):
5+
"""Dicts with any keys work."""
6+
assert converter.structure({b"": "1"}, Dict[Any, int]) == {b"": 1}
7+
8+
9+
def test_any_values(converter):
10+
"""Dicts with any values work."""
11+
assert converter.structure({"1": b"1"}, Dict[int, Any]) == {1: b"1"}

0 commit comments

Comments
 (0)