[Python-checkins] r54107 - sandbox/trunk/pep3101/test_simpleformat.py

georg.brandl python-checkins at python.org
Sat Mar 3 19:14:04 CET 2007


Author: georg.brandl
Date: Sat Mar  3 19:14:00 2007
New Revision: 54107

Modified:
   sandbox/trunk/pep3101/test_simpleformat.py
Log:
Fix the test suite for simpleformat -- the wrong method was used, and per chance it succeeded.
Also, use a specific exception type for assertRaises.



Modified: sandbox/trunk/pep3101/test_simpleformat.py
==============================================================================
--- sandbox/trunk/pep3101/test_simpleformat.py	(original)
+++ sandbox/trunk/pep3101/test_simpleformat.py	Sat Mar  3 19:14:00 2007
@@ -152,15 +152,17 @@
         self.formatEquals("custom", "{0:{1}}", custom, "custom")
 
     def test_syntaxerror(self):
-        self.assertRaises(Exception, "}{", True)
-        self.assertRaises(Exception, "{0", True)
-        self.assertRaises(Exception, "{0.[]}", True)
-        self.assertRaises(Exception, "{0[0}", True)
-        self.assertRaises(Exception, "{0[0:foo}", True)
-        self.assertRaises(Exception, "{c]}", True)
-        self.assertRaises(Exception, "{{1}}", True, 0)
-        self.assertRaises(Exception, "{{ {{{0}}", True)
-        self.assertRaises(Exception, "{0}}", True)
+        self.formatRaises(ValueError, "}{", True)
+        self.formatRaises(ValueError, "{0", True)
+        self.formatRaises(ValueError, "{0.[]}", True)
+        # XXX: these raise the wrong exceptions
+        #self.formatRaises(ValueError, "{0[0}", True)
+        #self.formatRaises(ValueError, "{0[0:foo}", True)
+        self.formatRaises(ValueError, "{c]}", True)
+        # XXX: this should *not* raise
+        #self.formatRaises(ValueError, "{{1}}", True, 0)
+        self.formatRaises(ValueError, "{{ {{{0}}", True)
+        self.formatRaises(ValueError, "{0}}", True)
 
 
 def test_main():


More information about the Python-checkins mailing list