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

brett.cannon python-checkins at python.org
Wed Apr 18 05:14:00 CEST 2007


Author: brett.cannon
Date: Wed Apr 18 05:13:56 2007
New Revision: 54861

Modified:
   sandbox/trunk/pep0/test_pep0.py
Log:
Test multi-line data values.


Modified: sandbox/trunk/pep0/test_pep0.py
==============================================================================
--- sandbox/trunk/pep0/test_pep0.py	(original)
+++ sandbox/trunk/pep0/test_pep0.py	Wed Apr 18 05:13:56 2007
@@ -70,6 +70,19 @@
         self.create_simple_pep("XXX")
         self.failUnlessRaises(ValueError, pep0.parse.consume_pep, self.path)
 
+    def test_consume_pep_multiline_data(self):
+        # If data spans multiple lines it should come out as a single one after
+        # parsing.
+        line1 = "a, b, c,"
+        line2 = "d, e, f"
+        with open(self.path, 'w') as pep_file:
+            pep_file.write("PEP: %s\n" % self.num)
+            pep_file.write("multiline: a, b, c,\n")
+            pep_file.write(" d, e, f\n")
+            pep_file.write("\nBody")
+        metadata = pep0.parse.consume_pep(self.path)
+        self.failUnlessEqual(metadata['multiline'], line1 + line2)
+
 
 class HandlerTests(unittest.TestCase):
 


More information about the Python-checkins mailing list