@@ -528,6 +528,56 @@ def divisibleBy(self, expect, instance, dB):
528528 disallow = [u"string" , {"properties" : {u"foo" : {u"type" : u"string" }}}]
529529 ))
530530
531+ @parametrized (
532+ ("" , "valid" , {"foo" : "baz" , "bar" : 2 }),
533+ ("mismatch_extends" , "invalid" , {"foo" : "baz" }),
534+ ("mismatch_extended" , "invalid" , {"bar" : 2 }),
535+ ("wrong_type" , "invalid" , {"foo" : "baz" , "bar" : "quux" }),
536+ )
537+ def extends (self , expect , instance ):
538+ schema = {
539+ "properties" : {"bar" : {"type" : "integer" , "required" : True }},
540+ "extends" : {
541+ "properties" : {
542+ "foo" : {"type" : "string" , "required" : True },
543+ }
544+ },
545+ }
546+
547+ test = validation_test (** schema )
548+ test (self , expect , instance )
549+
550+ @parametrized (
551+ ("" , "valid" , {"foo" : "quux" , "bar" : 2 , "baz" : None }),
552+ ("mismatch_first_extends" , "invalid" , {"bar" : 2 , "baz" : None }),
553+ ("mismatch_second_extends" , "invalid" , {"foo" : "quux" , "bar" : 2 }),
554+ ("mismatch_both" , "invalid" , {"bar" : 2 }),
555+ )
556+ def multiple_extends (self , expect , instance ):
557+ schema = {
558+ "properties" : {"bar" : {"type" : "integer" , "required" : True }},
559+ "extends" : [
560+ {
561+ "properties" : {
562+ "foo" : {"type" : "string" , "required" : True },
563+ }
564+ },
565+ {
566+ "properties" : {
567+ "baz" : {"type" : "null" , "required" : True },
568+ }
569+ },
570+ ],
571+ }
572+
573+ test = validation_test (** schema )
574+ test (self , expect , instance )
575+
576+ extends_simple_types = parametrized (
577+ ("" , "valid" , 25 ),
578+ ("mismatch_extends" , "invalid" , 35 )
579+ )(validation_test (minimum = 20 , extends = {"maximum" : 30 }))
580+
531581 def test_stop_on_error (self ):
532582 instance = [1 , 2 ]
533583
0 commit comments