Skip to content

zope.schema.Bool violates it's interface spec #113

Description

@agroszer

Still regressions on the Bool default thing....

    def test_field_Bool_is_required(self):
        # the Bool field is required by default
        from zope.schema import Bool
        field = Bool(__name__='testing')
        self.assertTrue(field.required)

    def test_field_Bool_default_is_None(self):
        # the Bool field has no default set (None)
        from zope.schema import Bool
        field = Bool(__name__='testing')
        self.assertIsNone(field.default)


    def test_bool_not_required(self):
        """If class Bool is used as a schema itself, it must not be required.
        """
        from zope.schema.interfaces import IBool
        # treat IBool as schema with fields
        field = IBool.get("required")
        self.assertFalse(field.required)

    def test_bool_defaults_to_false(self):
        """If class Bool is used as a schema itself, it must default to False
        """
        from zope.schema.interfaces import IBool
        # treat IBool as schema with fields
        field = IBool.get("default")
        self.assertFalse(field.default)

since

classImplementsFirst(Bool, IBool)

I'd expect that IBool['default'] == Bool().default and IBool['required'] == Bool().required otherwise Bool violates it's interface contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions