Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Assignment of Structured Config to Subscripted Dict raising wrong error. #410

Closed
4 tasks done
pereman2 opened this issue Oct 18, 2020 · 0 comments · Fixed by #416
Closed
4 tasks done

Assignment of Structured Config to Subscripted Dict raising wrong error. #410

pereman2 opened this issue Oct 18, 2020 · 0 comments · Fixed by #416
Labels
bug Something isn't working
Milestone

Comments

@pereman2
Copy link
Contributor

Describe the bug
Assigning a structured config into a Subscripted Dict error message is not representing correctly the action.
To Reproduce

@dataclass
class DictClass:
    foo: Dict[str, int] = field(default_factory=lambda: {"a": 4})

@dataclass
class User:
    age: int = 4
    name: str = "foo"
cfg = OmegaConf.structured(DictClass)
cfg.foo = User()
ValidationError: Invalid type assigned : str is not a subclass of int. value: foo
        full_key: foo.name
        reference_type=Dict[str, int]
        object_type=dict

Expected behaviour
Structured config assignment to subscripted dicts should't be allowed and should have an descriptive error message.

Additional context

  • OmegaConf version: 2.1.0
  • Python version: 3.8
  • Operating system : macOS
  • Please provide a minimal repro
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants