-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
coqpit> ==================================== ERRORS ====================================
coqpit> ________________ ERROR collecting tests/test_nested_configs.py _________________
coqpit> tests/test_nested_configs.py:24: in <module>
coqpit> @dataclass
coqpit> /nix/store/7cf5i5czbwbv1j9ikwn25pnzf9hq4dzs-python3-3.11.3/lib/python3.11/dataclasses.py:1223: in dataclass
coqpit> return wrap(cls)
coqpit> /nix/store/7cf5i5czbwbv1j9ikwn25pnzf9hq4dzs-python3-3.11.3/lib/python3.11/dataclasses.py:1213: in wrap
coqpit> return _process_class(cls, init, repr, eq, order, unsafe_hash,
coqpit> /nix/store/7cf5i5czbwbv1j9ikwn25pnzf9hq4dzs-python3-3.11.3/lib/python3.11/dataclasses.py:958: in _process_class
coqpit> cls_fields.append(_get_field(cls, name, type, kw_only))
coqpit> /nix/store/7cf5i5czbwbv1j9ikwn25pnzf9hq4dzs-python3-3.11.3/lib/python3.11/dataclasses.py:815: in _get_field
coqpit> raise ValueError(f'mutable default {type(f.default)} for field '
coqpit> E ValueError: mutable default <class 'tests.test_nested_configs.SimpleConfig'> for field sc is not allowed: use default_factory
coqpit> =========================== short test summary info ============================
coqpit> ERROR tests/test_nested_configs.py - ValueError: mutable default <class 'tests.test_nested_configs.SimpleConfig'...
coqpit/tests/test_nested_configs.py
Lines 24 to 31 in 47f39ea
| @dataclass | |
| class NestedConfig(Coqpit): | |
| val_d: int = 10 | |
| val_e: int = None | |
| val_f: str = "Coqpit is great!" | |
| sc_list: List[SimpleConfig] = None | |
| sc: SimpleConfig = SimpleConfig() | |
| union_var: Union[List[SimpleConfig], SimpleConfig] = field(default_factory=lambda: [SimpleConfig(), SimpleConfig()]) |
Metadata
Metadata
Assignees
Labels
No labels