| 2108 | def test_field_metadata_custom_mapping(self): |
| 2109 | # Try a custom mapping. |
| 2110 | class SimpleNameSpace: |
| 2111 | def __init__(self, **kw): |
| 2112 | self.__dict__.update(kw) |
| 2113 | |
| 2114 | def __getitem__(self, item): |
| 2115 | if item == 'xyzzy': |
| 2116 | return 'plugh' |
| 2117 | return getattr(self, item) |
| 2118 | |
| 2119 | def __len__(self): |
| 2120 | return self.__dict__.__len__() |
| 2121 | |
| 2122 | @dataclass |
| 2123 | class C: |