r142 - branches/rewrite/tests/Config

Otavio Salvador partial-mirror-devel@lists.alioth.debian.org
Sat, 03 Jul 2004 14:50:56 -0600


Author: otavio
Date: Sat Jul  3 14:50:56 2004
New Revision: 142

Modified:
   branches/rewrite/tests/Config/test.py
Log:
Better tests.

Modified: branches/rewrite/tests/Config/test.py
==============================================================================
--- branches/rewrite/tests/Config/test.py	(original)
+++ branches/rewrite/tests/Config/test.py	Sat Jul  3 14:50:56 2004
@@ -25,16 +25,26 @@
 ## Set the debuggin level
 #getLogger().setLevel(DEBUG)
 
-def test(msg, conf):
+def test(msg, conf, should=None):
     stdout.write(msg + "... ")
     try:
         Config(conf)
-        print "Works."
+        if not should:
+            print "Works."
+        else:
+            print "Failed. This doesn't found the expected error."
     except InvalidOption, msg:
-        print("Failed to identify the [%s] option on [%s] section."
-              % (msg.option, msg.section))
+        if should == 'InvalidOption':
+            print("Works. Found the [%s] option on [%s] section."
+                  % (msg.option, msg.section))
+        else:
+            print("Failed. Wrongly found the [%s] option as wrong on [%s] section."
+                  % (msg.option, msg.section))
     except InvalidSection, msg:
-        print("Failed to identify the [%s] section." % msg.section)
+        if should == 'InvalidSection':
+            print("Works. Found the invalid section [%s]." % msg.section)
+        else:
+            print("Failed. Wrongly found the [%s] section as wrong." % msg.section)
     except Exception, msg:
         print "Failed. Returned", msg