[Zodb-checkins] CVS: Packages/ZConfig/tests - test_schema.py:1.12
Fred L. Drake, Jr.
fred@zope.com
Thu, 6 Feb 2003 10:48:13 -0500
Update of /cvs-repository/Packages/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv4622
Modified Files:
test_schema.py
Log Message:
Change the quoting style of multi-line strings to reduce the amount of
syntax needed; makes it easier to revise the texts being processed.
=== Packages/ZConfig/tests/test_schema.py 1.11 => 1.12 === (791/891 lines abridged)
--- Packages/ZConfig/tests/test_schema.py:1.11 Thu Feb 6 10:10:30 2003
+++ Packages/ZConfig/tests/test_schema.py Thu Feb 6 10:48:12 2003
@@ -97,26 +97,27 @@
def test_app_datatype(self):
dtname = __name__ + ".uppercase"
- schema = self.load_schema_text(
- "<schema>"
- " <key name='a' datatype='%s'/>"
- " <key name='b' datatype='%s' default='abc'/>"
- " <multikey name='c' datatype='%s'>"
- " <default>abc</default>"
- " <default>abc</default>"
- " </multikey>"
- " <multikey name='d' datatype='%s'>"
- " <default>not</default>"
- " <default>lower</default>"
- " <default>case</default>"
- " </multikey>"
- "</schema>"
- % (dtname, dtname, dtname, dtname))
- conf = self.load_config_text(schema,
- "a qwerty\n"
- "c upp\n"
- "c er \n"
- "c case\n")
+ schema = self.load_schema_text("""\
+ <schema>
+ <key name='a' datatype='%s'/>
+ <key name='b' datatype='%s' default='abc'/>
+ <multikey name='c' datatype='%s'>
+ <default>abc</default>
+ <default>abc</default>
+ </multikey>
+ <multikey name='d' datatype='%s'>
+ <default>not</default>
+ <default>lower</default>
+ <default>case</default>
+ </multikey>
+ </schema>
+ """ % (dtname, dtname, dtname, dtname))
+ conf = self.load_config_text(schema, """\
+ a qwerty
+ c upp
+ c er
+ c case
+ """)
eq = self.assertEqual
eq(conf.a, 'QWERTY')
eq(conf.b, 'ABC')
[-=- -=- -=- 791 lines omitted -=- -=- -=-]
# cannot extend non-existing section
- self.assertRaises(ZConfig.SchemaError, self.load_schema_text,
- "<schema>"
- " <sectiontype name='t2' extends='t1'/>"
- "</schema>")
+ self.assertRaises(ZConfig.SchemaError, self.load_schema_text, """\
+ <schema>
+ <sectiontype name='t2' extends='t1'/>
+ </schema>
+ """)
# cannot extend abstract type
- self.assertRaises(ZConfig.SchemaError, self.load_schema_text,
- "<schema>"
- " <abstracttype name='t1'/>"
- " <sectiontype name='t2' extends='t1'/>"
- "</schema>")
+ self.assertRaises(ZConfig.SchemaError, self.load_schema_text, """\
+ <schema>
+ <abstracttype name='t1'/>
+ <sectiontype name='t2' extends='t1'/>
+ </schema>
+ """)
# cannot specify keytype
- self.assertRaises(ZConfig.SchemaError, self.load_schema_text,
- "<schema>"
- " <sectiontype name='t1' keytype='string'/>"
- " <sectiontype name='t2' extends='t1'"
- " keytype='integer'/>"
- "</schema>")
+ self.assertRaises(ZConfig.SchemaError, self.load_schema_text, """\
+ <schema>
+ <sectiontype name='t1' keytype='string'/>
+ <sectiontype name='t2' extends='t1'
+ keytype='integer'/>
+ </schema>
+ """)
def test_schema_keytype(self):
- schema = self.load_schema_text("<schema keytype='ipaddr-or-hostname'>"
- " <key name='+' attribute='table'"
- " datatype='ipaddr-or-hostname'/>"
- "</schema>")
+ schema = self.load_schema_text("""\
+ <schema keytype='ipaddr-or-hostname'>
+ <key name='+' attribute='table' datatype='ipaddr-or-hostname'/>
+ </schema>
+ """)
conf = self.load_config_text(schema,
"host.example.com 127.0.0.1\n"
"www.example.org 127.0.0.2\n")