[Checkins] SVN: manuel/trunk/src/manuel/ fix bug, with test
Benji York
benji at zope.com
Sat Jun 6 09:39:45 EDT 2009
Log message for revision 100663:
fix bug, with test
Changed:
U manuel/trunk/src/manuel/__init__.py
A manuel/trunk/src/manuel/bugs.txt
U manuel/trunk/src/manuel/tests.py
-=-
Modified: manuel/trunk/src/manuel/__init__.py
===================================================================
--- manuel/trunk/src/manuel/__init__.py 2009-06-06 13:31:22 UTC (rev 100662)
+++ manuel/trunk/src/manuel/__init__.py 2009-06-06 13:39:45 UTC (rev 100663)
@@ -159,6 +159,10 @@
text = start_match.group()
else:
end_match = end.search(region.source, start_match.end())
+
+ # couldn't find a match for the end re, try again
+ if end_match is None:
+ continue
check_region_end(region, end_match)
text = region.source[start_match.start():end_match.end()]
Added: manuel/trunk/src/manuel/bugs.txt
===================================================================
--- manuel/trunk/src/manuel/bugs.txt (rev 0)
+++ manuel/trunk/src/manuel/bugs.txt 2009-06-06 13:39:45 UTC (rev 100663)
@@ -0,0 +1,23 @@
+Miscellaneous Tests
+===================
+
+Fixed Bugs
+----------
+
+If a line of text matches both a "start" and "end" regular expression, no
+exception should be raised.
+
+ >>> source = """\
+ ... Blah, blah.
+ ...
+ ... xxx
+ ... some text
+ ... xxx
+ ...
+ ... """
+ >>> import manuel
+ >>> document = manuel.Document(source)
+ >>> import re
+ >>> start = end = re.compile(r'^xxx$', re.MULTILINE)
+ >>> document.find_regions(start, end)
+ [<manuel.Region object at ...]
Property changes on: manuel/trunk/src/manuel/bugs.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: manuel/trunk/src/manuel/tests.py
===================================================================
--- manuel/trunk/src/manuel/tests.py 2009-06-06 13:31:22 UTC (rev 100662)
+++ manuel/trunk/src/manuel/tests.py 2009-06-06 13:39:45 UTC (rev 100663)
@@ -15,13 +15,13 @@
])
suite = unittest.TestSuite()
- tests = ['README.txt', 'footnote.txt']
+ tests = ['README.txt', 'footnote.txt', 'bugs.txt']
# Run the tests once with doctest.
suite.addTest(
doctest.DocFileSuite(optionflags=optionflags, checker=checker, *tests))
- # Run them again with manuel's doctest support.
+ # Run them again with Manuel's doctest support.
m = manuel.doctest.Manuel(optionflags=optionflags, checker=checker)
suite.addTest(manuel.testing.TestSuite(m, *tests))
More information about the Checkins
mailing list