def test_validate_only_if_not_none(self): field = PasswordField(required=False) expect(field.validate(None)).to_be_true()
def test_validate_enforces_password_type(self): field = PasswordField() expect(field.validate(1)).to_be_false()