[Zope-Checkins] CVS: Packages/ZConfig/tests - testConfig.py:1.7
Fred L. Drake, Jr.
fred@zope.com
Thu, 7 Nov 2002 15:05:30 -0500
Update of /cvs-repository/Packages/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv13361/tests
Modified Files:
testConfig.py
Log Message:
Add support for loading from file objects.
=== Packages/ZConfig/tests/testConfig.py 1.6 => 1.7 ===
--- Packages/ZConfig/tests/testConfig.py:1.6 Mon Oct 21 14:59:55 2002
+++ Packages/ZConfig/tests/testConfig.py Thu Nov 7 15:05:25 2002
@@ -14,6 +14,7 @@
"""Tests of the configuration data structures and loader."""
import os
+import StringIO
import tempfile
import unittest
import urllib
@@ -21,6 +22,7 @@
import warnings
import ZConfig
+
from ZConfig.Context import Context
from ZConfig.Common import ConfigurationError, ConfigurationTypeError
@@ -237,6 +239,15 @@
finally:
os.chdir(pwd)
os.unlink(fn)
+
+ def test_load_from_fileobj(self):
+ sio = StringIO.StringIO("name value\n"
+ "<section>\n"
+ " name value2\n"
+ "</section>\n")
+ cf = ZConfig.loadfile(sio)
+ self.assertEqual(cf.get("name"), "value")
+ self.assertEqual(cf.getSection("section").get("name"), "value2")
def write_tempfile(self):
fn = tempfile.mktemp()