[Zope-Checkins] CVS: Packages/ZConfig/tests - testAltSyntax.py:1.1.2.1
Fred L. Drake, Jr.
fdrake@acm.org
Thu, 10 Oct 2002 11:27:38 -0400
Update of /cvs-repository/Packages/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv7252/tests
Added Files:
Tag: zconfig-brace-syntax
testAltSyntax.py
Log Message:
Add the example of an alternate syntax.
=== Added File Packages/ZConfig/tests/testAltSyntax.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Tests of the configuration data structures and loader.
$Id: testAltSyntax.py,v 1.1.2.1 2002/10/10 15:27:37 fdrake Exp $
"""
import unittest
import ZConfig
from ZConfig.Context import Context
from testConfig import TestBase
class ConfigurationTestCase(TestBase):
def load(self, relurl, context=None):
if context is None:
context = BracesContext()
return TestBase.load(self, relurl, context)
def test_simple_gets(self):
conf = self.load("simplebraces.conf")
self.check_simple_gets(conf)
def test_include_braces(self):
conf = self.load("includebraces.conf")
self.assertEqual(conf.get("var1"), "abc")
self.assertEqual(conf.get("var2"), "value2")
self.assertEqual(conf.get("var3"), "value3")
class BracesContext(Context):
def parse(self, file, section, url):
from ZConfig.BracesStyle import Parse
Parse(file, self, section, url)
def test_suite():
return unittest.makeSuite(ConfigurationTestCase)
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')