Esempio n. 1
0
 def test_enum4(self):
     s1 = {'enum': [3, 4, 5]}
     s2 = {'enum': [4, 5, 3]}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
 def test_empty_items1(self):
     s1 = {"type": "array"}
     s2 = {"type": "array", "items": {}}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
 def test_dictItems_listItems1(self):
     s1 = {"type": "array", "items": {"type": "string"}}
     s2 = {"type": "array", "items": [{"type": "string"}]}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_min_max_min_max3(self):
     s1 = {"type": "integer", "minimum": 5, "maximum": 20}
     s2 = {"type": "integer", "minimum": 40, "maximum": 100}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_min_max(self):
     s1 = {"type": "array", "minItems": 5, "maxItems:": 10}
     s2 = {"type": "array", "minItems": 1, "maxItems:": 20}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_min_num_int(self):
     s1 = {"type": "number", "minimum": 1.5}
     s2 = {"type": "integer", "minimum": 1}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_mulOf_num_int2(self):
     s1 = {"type": "number", "multipleOf": 1}
     s2 = {"type": "integer"}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
Esempio n. 8
0
 def test_t_t_4(self):
     s1 = {'type': 'integer'}
     s2 = {'type': ['number', 'string']}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
Esempio n. 9
0
 def test_t_t_5(self):
     s1 = {'type': ['string', 'array']}
     s2 = {'type': ['number', 'string']}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
Esempio n. 10
0
 def test_top_bot(self):
     s1 = {}
     s2 = {'type': 'string', 'enum': [1, 2, 3]}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
Esempio n. 11
0
 def test_t_t_2(self):
     s1 = {'type': 'number'}
     s2 = {'type': ['number']}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
Esempio n. 12
0
 def test_top_nottop(self):
     s1 = {}
     s2 = {'type': 'string'}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
Esempio n. 13
0
 def test_enum6(self):
     s1 = {'enum': [3, 4, 5], 'type': 'string'}
     s2 = {'enum': [4, 5, 3]}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
Esempio n. 14
0
 def test_enum5(self):
     s1 = {'enum': [3, 4, 5], 'allOf': [{'enum': [1, 2]}]}
     s2 = {'enum': [4, 5, 3]}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_mulOf_min_min_max(self):
     s1 = {"type": "number", "multipleOf": 10, "minimum": 10}
     s2 = {"type": "number", "minimum": 5, "maximum": 500}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
Esempio n. 16
0
 def test_str_bool_any(self):
     s1 = {'type': ['string', 'boolean']}
     s2 = {'anyOf': [{'type': 'string'}, {'type': 'boolean'}]}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
 def test_int_num(self):
     s1 = {"type": "integer"}
     s2 = {"type": "number"}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
Esempio n. 18
0
 def test_enum1(self):
     s1 = {'enum': [1, 2, 'test', False]}
     s2 = {'type': ['integer', 'string'], 'minimum': 10, 'enum': [1, 2]}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
 def test_mulOf_num_min_int(self):
     s1 = {"type": "number", "multipleOf": 10}
     s2 = {"type": "integer", "minimum": 5}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_mulOf3(self):
     s1 = {"type": "integer", "multipleOf": 10}
     s2 = {"type": "integer", "multipleOf": 98}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_enum2(self):
     s1 = {"enum": [1.0, 2, 3]}
     s2 = {"enum": [1, 2.0]}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
 def test_min_max_mul(self):
     s1 = {"type": "integer", "minimum": 5, "maximum": 10, "multipleOf": 15}
     s2 = {"type": "integer"}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_enum4(self):
     s1 = {"enum": [1, 2.0, 3]}
     s2 = {"type": "integer"}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_max_max(self):
     s1 = {"type": "integer", "maximum": 10}
     s2 = {"type": "integer", "maximum": 5}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
Esempio n. 25
0
 def test_unique(self):
     s1 = {"type": "array", "uniqueItems": True}
     s2 = {"type": "array", "uniqueItems": False}
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
 def test_min_max_min_max2(self):
     s1 = {"type": "number", "minimum": 5, "maximum": 20}
     s2 = {"type": "number", "minimum": 10, "maximum": 20}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
Esempio n. 27
0
 def test_empty_items5(self):
     s1 = {"type": "array", "items": [{}, {}], "additionalItems": False}
     s2 = {"type": "array", "items": [{}], "additionalItems": False}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
 def test_mulOf2(self):
     s1 = {"type": "number", "multipleOf": 1.5}
     s2 = {"type": "number", "multipleOf": 6}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertTrue(isSubschema(s2, s1))
 def test_1(self):
     s1 = {
         "type": "array",
         "items": {
             "$ref": "#/definitions/positiveInteger"
         },
         "definitions": {
             "positiveInteger": {
                 "type": "integer",
                 "minimum": 0,
                 "exclusiveMinimum": True
             }
         }
     }
     s2 = {
         "type": "array",
         "items": {
             "$ref": "#/definitions/positiveInteger"
         },
         "definitions": {
             "positiveInteger": {
                 "type": "integer",
                 "minimum": -1,
                 "exclusiveMinimum": True
             }
         }
     }
     with self.subTest():
         self.assertTrue(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))
Esempio n. 30
0
 def test_enum3(self):
     s1 = {'enum': [3, 4, 5]}
     s2 = {'enum': [1, 2, 3]}
     with self.subTest():
         self.assertFalse(isSubschema(s1, s2))
     with self.subTest():
         self.assertFalse(isSubschema(s2, s1))