8000 PolyModelType does not validate · Issue #440 · schematics/schematics · GitHub
[go: up one dir, main page]

8000
Skip to content
PolyModelType does not validate #440
@alexhayes

Description

@alexhayes

This is perhaps similar to #426 however I thought I should point it out in case it's not.

Essentially PolyModelType does not validate as I would expect, in fact, it doesn't seem to validate at all by default, unless I'm missing something.

class A(Model):
    higher_than_ten = IntType(min_value=10, required=True)


class B(Model):
    higher_than_fifty = IntType(min_value=50, required=True)


foo = C(
    raw_data=dict(
        poly=A(dict(higher_than_ten=1))
    ),
    validate=True
)
# I expect this to raise, but doesn't

foo.validate()
# I expect this to raise, but doesn't

e = A(dict(higher_than_ten=1))
e.validate()
# Raises as expected

Am I correct in thinking the calls to validate (either through instantiation or via method call) above should raise?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0