Skip to content

Commit 0522f91

Browse files
committed
Fix bad merge.
1 parent 688420f commit 0522f91

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

tests.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,13 @@ def maximum(self, expect, eM, instance):
419419
("exact", "valid", [1]),
420420
("longer", "valid", [1, 2]),
421421
("too_short", "invalid", []),
422-
("ignores_strings", "valid", "a"),
423422
)(validation_test(minItems=1))
424423

425424
maxItems = parametrized(
426425
("exact", "valid", [1, 2]),
427426
("shorter", "valid", [1]),
428427
("empty", "valid", []),
429428
("too_long", "invalid", [1, 2, 3]),
430-
("ignores_strings", "valid", "aaaa"),
431429
)(validation_test(maxItems=2))
432430

433431
uniqueItems = parametrized(
@@ -450,19 +448,16 @@ def maximum(self, expect, eM, instance):
450448
pattern = parametrized(
451449
("match", "valid", "aaa"),
452450
("mismatch", "invalid", "ab"),
453-
("ignores_other_stuff", "valid", True),
454451
)(validation_test(pattern="^a*$"))
455452

456453
minLength = parametrized(
457454
("", "valid", "foo"),
458455
("too_short", "invalid", "f"),
459-
("ignores_arrays", "valid", [1]),
460456
)(validation_test(minLength=2))
461457

462458
maxLength = parametrized(
463459
("", "valid", "f"),
464460
("too_long", "invalid", "foo"),
465-
("ignores_arrays", "valid", [1, 2, 3]),
466461
)(validation_test(maxLength=2))
467462

468463
@parametrized(
@@ -824,24 +819,45 @@ def test_tree(self):
824819

825820

826821
class TestIgnorePropertiesForIrrelevantTypes(unittest.TestCase):
827-
def test_minimum(self):
822+
def test_minimum_ignores_nonnumbers(self):
828823
validate("x", {"type": ["string", "number"], "minimum": 10})
829824

830-
def test_maximum(self):
825+
def test_maximum_ignores_nonnumbers(self):
831826
validate("x", {"type": ["string", "number"], "maximum": 10})
832827

833-
def test_properties(self):
828+
def test_properties_ignores_nonobjects(self):
834829
validate(1, {"type": ["integer", "object"], "properties": {"x": {}}})
835830

836-
def test_items(self):
831+
def test_additionalProperties_ignores_nonobjects(self):
832+
validate(None, {"additionalProperties" : False})
833+
834+
def test_minLength_ignores_nonstrings(self):
835+
validate([1], {"minLength" : 3})
836+
837+
def test_maxLength_ignores_nonstrings(self):
838+
validate([1, 2, 3], {"minLength" : 2})
839+
840+
def test_pattern_ignores_non_strings(self):
841+
validate(True, {"pattern" : "^a*$"})
842+
843+
def test_items_ignores_nonarrays(self):
837844
validate(
838845
1, {"type": ["integer", "array"], "items": {"type": "string"}}
839846
)
840847

841-
def test_divisibleBy(self):
848+
def test_minItems_ignores_nonarrays(self):
849+
validate("x", {"minItems" : 3})
850+
851+
def test_maxItems_ignores_nonarrays(self):
852+
validate("xxxx", {"maxItems" : 3})
853+
854+
def test_additionalItems_ignores_nonarrays(self):
855+
validate(None, {"additionalItems" : False})
856+
857+
def test_divisibleBy_ignores_nonnumbers(self):
842858
validate("x", {"type": ["integer", "string"], "divisibleBy": 10})
843859

844-
def test_dependencies(self):
860+
def test_dependencies_ignores_nonobjects(self):
845861
validate("foo", {"dependencies" : {"foo": "bar"}})
846862

847863

0 commit comments

Comments
 (0)