[Zodb-checkins] CVS: Packages/ZConfig/tests - testSubstitution.py:1.6

Fred L. Drake, Jr. fred@zope.com
Wed, 4 Dec 2002 15:59:17 -0500


Update of /cvs-repository/Packages/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv5636/tests

Modified Files:
	testSubstitution.py 
Log Message:
Add isname() function to ZConfig.Substitution.

=== Packages/ZConfig/tests/testSubstitution.py 1.5 => 1.6 ===
--- Packages/ZConfig/tests/testSubstitution.py:1.5	Tue Dec  3 10:31:17 2002
+++ Packages/ZConfig/tests/testSubstitution.py	Wed Dec  4 15:59:14 2002
@@ -8,7 +8,7 @@
 from types import StringType
 from UserDict import UserDict
 
-from ZConfig.Substitution import get, getnames, substitute
+from ZConfig.Substitution import get, getnames, isname, substitute
 from ZConfig.Substitution import SubstitutionRecursionError
 from ZConfig.Substitution import SubstitutionSyntaxError
 
@@ -134,6 +134,16 @@
         self.assertRaises(SubstitutionSyntaxError, getnames, "${name")
         self.assertRaises(SubstitutionSyntaxError, getnames, "${1name}")
         self.assertRaises(SubstitutionSyntaxError, getnames, "${ name}")
+
+    def test_isname(self):
+        self.assert_(isname("abc"))
+        self.assert_(isname("abc_def"))
+        self.assert_(isname("_abc"))
+        self.assert_(isname("abc_"))
+        self.assert_(not isname("abc-def"))
+        self.assert_(not isname("-def"))
+        self.assert_(not isname("abc-"))
+        self.assert_(not isname(""))
 
 
 def test_suite():