[Python-checkins] r54765 - sandbox/trunk/pep0/test_pep0.py

brett.cannon python-checkins at python.org
Thu Apr 12 04:07:03 CEST 2007


Author: brett.cannon
Date: Thu Apr 12 04:07:02 2007
New Revision: 54765

Modified:
   sandbox/trunk/pep0/test_pep0.py
Log:
Strengthen author parsing.  Currently leads to a failure.


Modified: sandbox/trunk/pep0/test_pep0.py
==============================================================================
--- sandbox/trunk/pep0/test_pep0.py	(original)
+++ sandbox/trunk/pep0/test_pep0.py	Thu Apr 12 04:07:02 2007
@@ -36,22 +36,18 @@
         # Name <email>,
         # email (name),
         # Name.
-        author = "Guido van Rossum"
-        str_rep = "%s <email>" % author
-        self.failUnlessEqual(pep0.handle_author(str_rep), [author])
-        str_rep += ','
-        self.failUnlessEqual(pep0.handle_author(str_rep), [author])
-        str_rep = "email (%s)" % author
-        self.failUnlessEqual(pep0.handle_author(str_rep), [author])
-        str_rep += ','
-        self.failUnlessEqual(pep0.handle_author(str_rep), [author])
-        str_rep = author
-        self.failUnlessEqual(pep0.handle_author(str_rep), [author])
-        str_rep += ','
-        self.failUnlessEqual(pep0.handle_author(str_rep), [author])
         authors = ["Guido van Rossum", "Brett Cannon"]
-        str_rep = ', '.join(authors)
-        self.failUnlessEqual(pep0.handle_author(str_rep), authors)
+        formats = ["%s <email>", "email (%s)", "%s"]
+        for format in formats:
+            rep = format % authors[0]
+            expect = authors[0:1]
+            self.failUnlessEqual(pep0.handle_author(rep), expect)
+            rep += ','
+            self.failUnlessEqual(pep0.handle_author(rep), expect)
+            rep += format % authors[1]
+            self.failUnlessEqual(pep0.handle_author(rep), authors)
+            rep += ','
+            self.failUnlessEqual(pep0.handle_author(rep), authors)
 
 
 class ParseMetaDataTests(unittest.TestCase):


More information about the Python-checkins mailing list