~lifeless/zconfig/bug-481512

« back to all changes in this revision

Viewing changes to ZConfig/tests/test_schema.py

  • Committer: fdrake
  • Date: 2008-12-05 19:29:46 UTC
  • Revision ID: svn-v4:62d5b8a3-27da-0310-9561-8e5933582275:ZConfig/trunk:93689
Fixed support for schema descriptions that override descriptions from a base
schema.  If multiple base schema provide descriptions but the derived schema
does not, the first base mentioned that provides a description wins.

https://bugs.launchpad.net/zconfig/+bug/259475

Show diffs side-by-side

added added

removed removed

Lines of Context:
1013
1013
                          self.load_schema_text,
1014
1014
            "<schema extends='%s/library.xml#foo'/>" % CONFIG_BASE)
1015
1015
 
 
1016
    def test_extends_description_override(self):
 
1017
        schema = self.load_schema_text("""\
 
1018
           <schema extends='%s/base.xml %s/library.xml'>
 
1019
             <description>
 
1020
               overriding description
 
1021
             </description>
 
1022
             <section name='A' type='type-a' />
 
1023
             <section name='X' type='type-X' />
 
1024
           </schema>
 
1025
           """ % (CONFIG_BASE, CONFIG_BASE))
 
1026
        description = schema.description.strip()
 
1027
        self.assertEqual(description, "overriding description")
 
1028
 
 
1029
    def test_extends_description_first_extended_wins(self):
 
1030
        schema = self.load_schema_text("""\
 
1031
           <schema extends='%s/base.xml %s/library.xml'>
 
1032
             <section name='A' type='type-a' />
 
1033
             <section name='X' type='type-X' />
 
1034
           </schema>
 
1035
           """ % (CONFIG_BASE, CONFIG_BASE))
 
1036
        description = schema.description.strip()
 
1037
        self.assertEqual(description, "base description")
 
1038
 
1016
1039
    def test_multi_extends_implicit_OK(self):
1017
1040
        self.load_schema_text("""\
1018
1041
           <schema extends='%s/base.xml %s/library.xml'>