Trailing commae.
This commit is contained in:
@@ -70,8 +70,8 @@ class TestCLI(unittest.TestCase):
|
|||||||
"anyOf": [
|
"anyOf": [
|
||||||
{"minimum": 20},
|
{"minimum": 20},
|
||||||
{"type": "string"},
|
{"type": "string"},
|
||||||
{"required": True}
|
{"required": True},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
"instances": [1],
|
"instances": [1],
|
||||||
"error_format": "{error.message}",
|
"error_format": "{error.message}",
|
||||||
|
@@ -25,9 +25,9 @@ class TestBestMatch(unittest.TestCase):
|
|||||||
"foo" : {
|
"foo" : {
|
||||||
"minProperties" : 2,
|
"minProperties" : 2,
|
||||||
"properties" : {"bar" : {"type" : "object"}},
|
"properties" : {"bar" : {"type" : "object"}},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
best = self.best_match(validator.iter_errors({"foo" : {"bar" : []}}))
|
best = self.best_match(validator.iter_errors({"foo" : {"bar" : []}}))
|
||||||
self.assertEqual(best.validator, "minProperties")
|
self.assertEqual(best.validator, "minProperties")
|
||||||
@@ -135,7 +135,7 @@ class TestBestMatch(unittest.TestCase):
|
|||||||
{"type" : "string"},
|
{"type" : "string"},
|
||||||
{
|
{
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"bar" : {"type" : "array"}
|
"bar" : {"type" : "array"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -329,7 +329,7 @@ class TestErrorInitReprStr(unittest.TestCase):
|
|||||||
"validator": "type",
|
"validator": "type",
|
||||||
"validator_value": "string",
|
"validator_value": "string",
|
||||||
"instance": 5,
|
"instance": 5,
|
||||||
"schema": {"type": "string"}
|
"schema": {"type": "string"},
|
||||||
}
|
}
|
||||||
# Just the message should show if any of the attributes are unset
|
# Just the message should show if any of the attributes are unset
|
||||||
for attr in kwargs:
|
for attr in kwargs:
|
||||||
|
@@ -83,7 +83,7 @@ class TestIterErrors(unittest.TestCase):
|
|||||||
schema = {
|
schema = {
|
||||||
u"disallow" : u"array",
|
u"disallow" : u"array",
|
||||||
u"enum" : [["a", "b", "c"], ["d", "e", "f"]],
|
u"enum" : [["a", "b", "c"], ["d", "e", "f"]],
|
||||||
u"minItems" : 3
|
u"minItems" : 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
got = (e.message for e in self.validator.iter_errors(instance, schema))
|
got = (e.message for e in self.validator.iter_errors(instance, schema))
|
||||||
@@ -101,7 +101,7 @@ class TestIterErrors(unittest.TestCase):
|
|||||||
"foo" : {u"type" : "string"},
|
"foo" : {u"type" : "string"},
|
||||||
"bar" : {u"minItems" : 2},
|
"bar" : {u"minItems" : 2},
|
||||||
"baz" : {u"maximum" : 10, u"enum" : [2, 4, 6, 8]},
|
"baz" : {u"maximum" : 10, u"enum" : [2, 4, 6, 8]},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
errors = list(self.validator.iter_errors(instance, schema))
|
errors = list(self.validator.iter_errors(instance, schema))
|
||||||
@@ -200,8 +200,8 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
schema = {
|
schema = {
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
{"minimum": 20},
|
{"minimum": 20},
|
||||||
{"type": "string"}
|
{"type": "string"},
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
validator = Draft4Validator(schema)
|
validator = Draft4Validator(schema)
|
||||||
@@ -268,11 +268,9 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
{"type": "integer"},
|
{"type": "integer"},
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {"foo": {"enum": [2]}},
|
||||||
"foo": {"enum": [2]}
|
},
|
||||||
}
|
],
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
validator = Draft3Validator(schema)
|
validator = Draft3Validator(schema)
|
||||||
@@ -344,7 +342,7 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
"foo" : {"type" : "string"},
|
"foo" : {"type" : "string"},
|
||||||
"bar" : {"minItems" : 2},
|
"bar" : {"minItems" : 2},
|
||||||
"baz" : {"maximum" : 10, "enum" : [2, 4, 6, 8]},
|
"baz" : {"maximum" : 10, "enum" : [2, 4, 6, 8]},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
validator = Draft3Validator(schema)
|
validator = Draft3Validator(schema)
|
||||||
@@ -384,10 +382,10 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
"properties" : {
|
"properties" : {
|
||||||
"bar" : {"required" : True},
|
"bar" : {"required" : True},
|
||||||
"baz" : {"minItems" : 2},
|
"baz" : {"minItems" : 2},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
validator = Draft3Validator(schema)
|
validator = Draft3Validator(schema)
|
||||||
@@ -450,9 +448,7 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
},
|
},
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["root"],
|
"required": ["root"],
|
||||||
"properties": {
|
"properties": {"root": {"$ref": "#/definitions/node"}},
|
||||||
"root": {"$ref": "#/definitions/node"},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = {
|
instance = {
|
||||||
@@ -465,8 +461,8 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
"ab": {
|
"ab": {
|
||||||
"name": "ab",
|
"name": "ab",
|
||||||
# missing "children"
|
# missing "children"
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -520,16 +516,14 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
"children",
|
"children",
|
||||||
"patternProperties",
|
"patternProperties",
|
||||||
"^.*$",
|
"^.*$",
|
||||||
"anyOf"
|
"anyOf",
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_additionalProperties(self):
|
def test_additionalProperties(self):
|
||||||
instance = {"bar": "bar", "foo": 2}
|
instance = {"bar": "bar", "foo": 2}
|
||||||
schema = {
|
schema = {"additionalProperties" : {"type": "integer", "minimum": 5}}
|
||||||
"additionalProperties" : {"type": "integer", "minimum": 5}
|
|
||||||
}
|
|
||||||
|
|
||||||
validator = Draft3Validator(schema)
|
validator = Draft3Validator(schema)
|
||||||
errors = validator.iter_errors(instance)
|
errors = validator.iter_errors(instance)
|
||||||
@@ -546,8 +540,8 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
schema = {
|
schema = {
|
||||||
"patternProperties" : {
|
"patternProperties" : {
|
||||||
"bar": {"type": "string"},
|
"bar": {"type": "string"},
|
||||||
"foo": {"minimum": 5}
|
"foo": {"minimum": 5},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
validator = Draft3Validator(schema)
|
validator = Draft3Validator(schema)
|
||||||
@@ -564,7 +558,7 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
instance = ["foo", 1]
|
instance = ["foo", 1]
|
||||||
schema = {
|
schema = {
|
||||||
"items": [],
|
"items": [],
|
||||||
"additionalItems" : {"type": "integer", "minimum": 5}
|
"additionalItems" : {"type": "integer", "minimum": 5},
|
||||||
}
|
}
|
||||||
|
|
||||||
validator = Draft3Validator(schema)
|
validator = Draft3Validator(schema)
|
||||||
@@ -581,7 +575,7 @@ class TestValidationErrorDetails(unittest.TestCase):
|
|||||||
instance = ["foo", "bar", 1]
|
instance = ["foo", "bar", 1]
|
||||||
schema = {
|
schema = {
|
||||||
"items": [{}],
|
"items": [{}],
|
||||||
"additionalItems" : {"type": "integer", "minimum": 5}
|
"additionalItems" : {"type": "integer", "minimum": 5},
|
||||||
}
|
}
|
||||||
|
|
||||||
validator = Draft3Validator(schema)
|
validator = Draft3Validator(schema)
|
||||||
|
Reference in New Issue
Block a user