[Zope-Checkins] CVS: Zope3/src/ZConfig/tests - test_schema.py:1.10.2.1

Sidnei da Silva sidnei@x3ng.com.br
Tue, 11 Feb 2003 09:41:48 -0500


Update of /cvs-repository/Zope3/src/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv18615/src/ZConfig/tests

Modified Files:
      Tag: paris-copypasterename-branch
	test_schema.py 
Log Message:
Updating from HEAD to make sure everything still works before merging

=== Zope3/src/ZConfig/tests/test_schema.py 1.10 => 1.10.2.1 === (799/899 lines abridged)
--- Zope3/src/ZConfig/tests/test_schema.py:1.10	Mon Jan 20 18:10:45 2003
+++ Zope3/src/ZConfig/tests/test_schema.py	Tue Feb 11 09:40:46 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')

[-=- -=- -=- 799 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")