running pytest running egg_info writing aptos.egg-info/PKG-INFO writing top-level names to aptos.egg-info/top_level.txt writing dependency_links to aptos.egg-info/dependency_links.txt writing entry points to aptos.egg-info/entry_points.txt reading manifest file 'aptos.egg-info/SOURCES.txt' writing manifest file 'aptos.egg-info/SOURCES.txt' running build_ext ============================= test session starts ============================== platform darwin -- Python 2.7.13, pytest-3.2.2, py-1.4.34, pluggy-0.4.0 rootdir: /Users/malrusha/Dev/aptos, inifile: collected 15 items tests/test_resolution.py F tests/test_schema_conversion.py F tests/test_swagger_version_3.py F tests/test_validation.py FFFFFFFFFF.. =================================== FAILURES =================================== __________________________ ResolutionTestCase.runTest __________________________ self = def runTest(self): with open(os.path.join(BASE_DIR, 'schema', 'product')) as fp: schema = json.load(fp) > component = Object.unmarshal(schema) tests/test_resolution.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:257: in unmarshal Properties.unmarshal(schema.get('properties', {}))) aptos/primitive.py:221: in unmarshal for name, member in schema.items()}) aptos/primitive.py:221: in for name, member in schema.items()}) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ identifier = 'object' @staticmethod def create(identifier): return { str: lambda identifier: { 'boolean': Boolean, 'null': Null, 'integer': Integer, 'number': Number, 'string': String, 'array': Array, 'object': Object, }.get(identifier, UnkownHandler), list: lambda identifier: Union, type(None): lambda identifier: UnkownHandler, > }[identifier.__class__](identifier) E KeyError: aptos/primitive.py:28: KeyError __________________________ AvroSchemaTestCase.runTest __________________________ self = def runTest(self): with open(os.path.join(BASE_DIR, 'schema', 'product')) as fp: schema = json.load(fp) > component = SchemaParser.parse(schema) tests/test_schema_conversion.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/parser.py:16: in parse component = Creator.create(schema.get('type')).unmarshal(schema) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ identifier = 'object' @staticmethod def create(identifier): return { str: lambda identifier: { 'boolean': Boolean, 'null': Null, 'integer': Integer, 'number': Number, 'string': String, 'array': Array, 'object': Object, }.get(identifier, UnkownHandler), list: lambda identifier: Union, type(None): lambda identifier: UnkownHandler, > }[identifier.__class__](identifier) E KeyError: aptos/primitive.py:28: KeyError _______________________ OpenAPIVersion3TestCase.runTest ________________________ self = def runTest(self): with open(os.path.join(BASE_DIR, 'schema', 'petstore')) as fp: schema = json.load(fp) > swagger = OpenAPIParser.parse(schema) tests/test_swagger_version_3.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/swagger/v3/parser.py:10: in parse component = Swagger.unmarshal(schema) aptos/swagger/v3/model.py:28: in unmarshal schema['paths'] = Paths.unmarshal(schema.get('paths', {})) aptos/swagger/v3/model.py:285: in unmarshal for name, member in schema.items()}) aptos/swagger/v3/model.py:285: in for name, member in schema.items()}) aptos/swagger/v3/model.py:272: in unmarshal schema[operation] = Operation.unmarshal(schema[operation]) aptos/swagger/v3/model.py:198: in unmarshal schema['responses'] = Responses.unmarshal(schema['responses']) aptos/swagger/v3/model.py:162: in unmarshal for name, member in schema.items()}) aptos/swagger/v3/model.py:162: in for name, member in schema.items()}) aptos/swagger/v3/model.py:149: in unmarshal schema['content'] = Content.unmarshal(schema['content']) aptos/swagger/v3/model.py:228: in unmarshal for name, member in schema.items()}) aptos/swagger/v3/model.py:228: in for name, member in schema.items()}) aptos/swagger/v3/model.py:249: in unmarshal ).unmarshal(schema['schema']) aptos/primitive.py:296: in unmarshal return Reference.unmarshal(schema) if '$ref' in schema else Enumeration.unmarshal(schema) # noqa: E501 aptos/primitive.py:98: in unmarshal return cls(**schema) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = kwargs = {'$ref': '#/components/schemas/Error', 'allOf': [], 'anyOf': [], 'definitions': {}, ...} address = '#/components/schemas/Error' def __init__(self, **kwargs): address = kwargs['$ref'] if Reference.expression.match(address) is None: # pragma: no cover raise ValueError('The value of the "$ref" property "%r" is not a valid URI Reference' % (address,)) # noqa: E501 self.address = address self.resolved = False self.value = None > super().__init__(**kwargs) E TypeError: super() takes at least 1 argument (0 given) aptos/primitive.py:280: TypeError ____________________________ StringTestCase.runTest ____________________________ self = def runTest(self): schema = json.loads(''' { "type": "string", "maxLength": 3 } ''') > string = primitive.String.unmarshal(schema) tests/test_validation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:98: in unmarshal return cls(**schema) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , maxLength = 3 minLength = 0, pattern = '' kwargs = {'allOf': [], 'anyOf': [], 'definitions': {}, 'oneOf': [], ...} def __init__(self, maxLength=0, minLength=0, pattern='', **kwargs): > super().__init__(**kwargs) E TypeError: super() takes at least 1 argument (0 given) aptos/primitive.py:161: TypeError ___________________________ BooleanTestCase.runTest ____________________________ self = def runTest(self): schema = json.loads(''' { "type": "boolean" } ''') boolean = primitive.Boolean.unmarshal(schema) with self.assertRaises(AssertionError): > boolean.accept(ValidationVisitor('true')) tests/test_validation.py:52: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:123: in accept return visitor.visit_boolean(self, *args) aptos/visitor.py:65: in visit_boolean self.visit_primitive(boolean, *args) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = primitive = , args = () instance = 'true' def visit_primitive(self, primitive, *args): instance = self.instance if primitive.const is not None: assert instance == primitive.const, 'instance %r is not equal to %r' % (instance, primitive.const) # noqa: E501 if primitive.type is not None: assert { str: lambda instance: Translator.translate(instance).__name__.lower() == primitive.type, # noqa: E501 list: lambda instance: Translator.translate(instance).__name__.lower() in primitive.type, # noqa: E501 > }[primitive.type.__class__](instance), 'instance %r is not in any of the sets listed %r' % (instance, primitive.type) # noqa: E501 E KeyError: aptos/visitor.py:59: KeyError _____________________________ NullTestCase.runTest _____________________________ self = def runTest(self): schema = json.loads(''' { "type": "null" } ''') null = primitive.Null.unmarshal(schema) with self.assertRaises(AssertionError): > null.accept(ValidationVisitor(False)) tests/test_validation.py:65: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:129: in accept return visitor.visit_null(self, *args) aptos/visitor.py:68: in visit_null self.visit_primitive(null, *args) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = primitive = , args = () instance = False def visit_primitive(self, primitive, *args): instance = self.instance if primitive.const is not None: assert instance == primitive.const, 'instance %r is not equal to %r' % (instance, primitive.const) # noqa: E501 if primitive.type is not None: assert { str: lambda instance: Translator.translate(instance).__name__.lower() == primitive.type, # noqa: E501 list: lambda instance: Translator.translate(instance).__name__.lower() in primitive.type, # noqa: E501 > }[primitive.type.__class__](instance), 'instance %r is not in any of the sets listed %r' % (instance, primitive.type) # noqa: E501 E KeyError: aptos/visitor.py:59: KeyError ____________________________ ArrayTestCase.runTest _____________________________ self = def runTest(self): schema = json.loads(''' { "type": "array", "items": [ { "type": "string" } ], "minItems": 1, "uniqueItems": true } ''') > array = primitive.Array.unmarshal(schema) tests/test_validation.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:200: in unmarshal }[schema['items'].__class__](schema['items']) aptos/primitive.py:199: in list: lambda instance: cls.ArrayList.unmarshal(instance), aptos/primitive.py:178: in unmarshal for element in schema) aptos/primitive.py:178: in for element in schema) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ identifier = 'string' @staticmethod def create(identifier): return { str: lambda identifier: { 'boolean': Boolean, 'null': Null, 'integer': Integer, 'number': Number, 'string': String, 'array': Array, 'object': Object, }.get(identifier, UnkownHandler), list: lambda identifier: Union, type(None): lambda identifier: UnkownHandler, > }[identifier.__class__](identifier) E KeyError: aptos/primitive.py:28: KeyError ___________________________ NumericTestCase.runTest ____________________________ self = def runTest(self): schema = json.loads(''' { "type": "number", "minimum": 0, "exclusiveMaximum": 100 } ''') > number = primitive.Number.unmarshal(schema) tests/test_validation.py:131: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:98: in unmarshal return cls(**schema) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , multipleOf = 1 maximum = None, exclusiveMaximum = 100, minimum = 0, exclusiveMinimum = None kwargs = {'allOf': [], 'anyOf': [], 'definitions': {}, 'oneOf': [], ...} def __init__(self, multipleOf=1, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, **kwargs): if multipleOf < 1: raise ValueError('The value of "multipleOf" MUST be a number, strictly greater than 0.') # noqa: E501 > super().__init__(**kwargs) E TypeError: super() takes at least 1 argument (0 given) aptos/primitive.py:138: TypeError ____________________________ ObjectTestCase.runTest ____________________________ self = def runTest(self): schema = json.loads(''' { "type": "object", "properties": { "firstName": { "type": "string" }, "lastName": { "type": "string" }, "age": { "type": "integer", "minimum": 0 } }, "required": ["firstName", "lastName"] } ''') > obj = primitive.Object.unmarshal(schema) tests/test_validation.py:200: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:257: in unmarshal Properties.unmarshal(schema.get('properties', {}))) aptos/primitive.py:221: in unmarshal for name, member in schema.items()}) aptos/primitive.py:221: in for name, member in schema.items()}) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ identifier = 'string' @staticmethod def create(identifier): return { str: lambda identifier: { 'boolean': Boolean, 'null': Null, 'integer': Integer, 'number': Number, 'string': String, 'array': Array, 'object': Object, }.get(identifier, UnkownHandler), list: lambda identifier: Union, type(None): lambda identifier: UnkownHandler, > }[identifier.__class__](identifier) E KeyError: aptos/primitive.py:28: KeyError ___________________________ ConstantTestCase.runTest ___________________________ self = def runTest(self): schema = json.loads(''' { "type": "object", "properties": { "five": { "type": "number", "const": 5.0 } } } ''') > obj = primitive.Object.unmarshal(schema) tests/test_validation.py:261: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:257: in unmarshal Properties.unmarshal(schema.get('properties', {}))) aptos/primitive.py:221: in unmarshal for name, member in schema.items()}) aptos/primitive.py:221: in for name, member in schema.items()}) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ identifier = 'number' @staticmethod def create(identifier): return { str: lambda identifier: { 'boolean': Boolean, 'null': Null, 'integer': Integer, 'number': Number, 'string': String, 'array': Array, 'object': Object, }.get(identifier, UnkownHandler), list: lambda identifier: Union, type(None): lambda identifier: UnkownHandler, > }[identifier.__class__](identifier) E KeyError: aptos/primitive.py:28: KeyError ____________________________ AllOfTestCase.runTest _____________________________ self = def runTest(self): schema = json.loads(''' { "allOf": [ { "type": "string", "maxLength": 3 } ] } ''') > component = primitive.Primitive.unmarshal(schema) tests/test_validation.py:279: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:93: in unmarshal schema['allOf'] = AllOf.unmarshal(schema.get('allOf', [])) aptos/primitive.py:52: in unmarshal for element in schema) aptos/primitive.py:52: in for element in schema) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ identifier = 'string' @staticmethod def create(identifier): return { str: lambda identifier: { 'boolean': Boolean, 'null': Null, 'integer': Integer, 'number': Number, 'string': String, 'array': Array, 'object': Object, }.get(identifier, UnkownHandler), list: lambda identifier: Union, type(None): lambda identifier: UnkownHandler, > }[identifier.__class__](identifier) E KeyError: aptos/primitive.py:28: KeyError ____________________________ AnyOfTestCase.runTest _____________________________ self = def runTest(self): schema = json.loads(''' { "anyOf": [ { "type": "string", "maxLength": 5 }, { "type": "number", "minimum": 0 } ] } ''') > component = primitive.Primitive.unmarshal(schema) tests/test_validation.py:301: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:94: in unmarshal schema['anyOf'] = AnyOf.unmarshal(schema.get('anyOf', [])) aptos/primitive.py:52: in unmarshal for element in schema) aptos/primitive.py:52: in for element in schema) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ identifier = 'string' @staticmethod def create(identifier): return { str: lambda identifier: { 'boolean': Boolean, 'null': Null, 'integer': Integer, 'number': Number, 'string': String, 'array': Array, 'object': Object, }.get(identifier, UnkownHandler), list: lambda identifier: Union, type(None): lambda identifier: UnkownHandler, > }[identifier.__class__](identifier) E KeyError: aptos/primitive.py:28: KeyError ____________________________ OneOfTestCase.runTest _____________________________ self = def runTest(self): schema = json.loads(''' { "oneOf": [ { "type": "number", "multipleOf": 5 }, { "type": "number", "multipleOf": 3 } ] } ''') > component = primitive.Primitive.unmarshal(schema) tests/test_validation.py:326: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aptos/primitive.py:95: in unmarshal schema['oneOf'] = OneOf.unmarshal(schema.get('oneOf', [])) aptos/primitive.py:52: in unmarshal for element in schema) aptos/primitive.py:52: in for element in schema) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ identifier = 'number' @staticmethod def create(identifier): return { str: lambda identifier: { 'boolean': Boolean, 'null': Null, 'integer': Integer, 'number': Number, 'string': String, 'array': Array, 'object': Object, }.get(identifier, UnkownHandler), list: lambda identifier: Union, type(None): lambda identifier: UnkownHandler, > }[identifier.__class__](identifier) E KeyError: aptos/primitive.py:28: KeyError ===================== 13 failed, 2 passed in 0.55 seconds ======================