def test_mixin_init(): class Mixin(object): def __init__(self, *args, **kwargs): kwargs['test'] = True super(Mixin, self).__init__(*args, **kwargs) MyValidator = validator_factory('MyValidator', Mixin) validator = MyValidator() assert validator._config['test']
def test_mixin_init(): class Mixin(object): def __init__(self, *args, **kwargs): kwargs["test"] = True super(Mixin, self).__init__(*args, **kwargs) MyValidator = validator_factory("MyValidator", Mixin) validator = MyValidator() assert validator._config["test"]
def __new__(cls, *args, **kwargs): if 'SchemaValidator' not in globals(): global SchemaValidator SchemaValidator = validator_factory('SchemaValidator', SchemaValidatorMixin) types_mapping = SchemaValidator.types_mapping.copy() types_mapping.update({ 'callable': TypeDefinition('callable', (Callable,), ()), 'hashable': TypeDefinition('hashable', (Hashable,), ()) }) SchemaValidator.types_mapping = types_mapping return super(DefinitionSchema, cls).__new__(cls)
def __new__(cls, *args, **kwargs): if 'SchemaValidator' not in globals(): global SchemaValidator SchemaValidator = validator_factory('SchemaValidator', SchemaValidatorMixin) types_mapping = SchemaValidator.types_mapping.copy() types_mapping.update( { 'callable': TypeDefinition('callable', (Callable,), ()), 'hashable': TypeDefinition('hashable', (Hashable,), ()), } ) SchemaValidator.types_mapping = types_mapping return super(DefinitionSchema, cls).__new__(cls)
def __new__(cls, *args, **kwargs): if 'SchemaValidator' not in globals(): global SchemaValidator SchemaValidator = validator_factory('SchemaValidator', SchemaValidatorMixin) return super(DefinitionSchema, cls).__new__(cls)
def __new__(cls, *args, **kwargs): if 'SchemaValidator' not in globals(): global SchemaValidator SchemaValidator = validator_factory('SchemaValidator', SchemaValidatorMixin) return super(DefinitionSchema, cls).__new__(cls)