[Checkins] SVN: Sandbox/J1m/customdoctests/src/zc/customdoctests/__init__.py Added a hook to specify the comment prefix to make things like:
Jim Fulton
jim at zope.com
Tue Feb 1 11:37:44 EST 2011
Log message for revision 120039:
Added a hook to specify the comment prefix to make things like:
js> zc.forEach(story.items, zc.pprint); // doctest: +NORMALIZE_WHITESPACE
work.
Changed:
U Sandbox/J1m/customdoctests/src/zc/customdoctests/__init__.py
-=-
Modified: Sandbox/J1m/customdoctests/src/zc/customdoctests/__init__.py
===================================================================
--- Sandbox/J1m/customdoctests/src/zc/customdoctests/__init__.py 2011-02-01 14:43:13 UTC (rev 120038)
+++ Sandbox/J1m/customdoctests/src/zc/customdoctests/__init__.py 2011-02-01 16:37:44 UTC (rev 120039)
@@ -22,6 +22,7 @@
def __init__(self, *args, **kw):
ps1 = kw.pop('ps1', '>>>')
ps2 = kw.pop('ps2', r'\.\.\.')
+ comment_prefix = kw.pop('comment_prefix', '#')
self.transform = kw.pop('transform', lambda s: s)
getattr(doctest.DocTestParser, '__init__', lambda : None)(*args, **kw)
@@ -39,6 +40,11 @@
)*)
''' % dict(ps1=ps1, ps2=ps2), re.MULTILINE | re.VERBOSE)
+ self._OPTION_DIRECTIVE_RE = re.compile(
+ comment_prefix +r'\s*doctest:\s*([^\n\'"]*)$', re.MULTILINE)
+
+
+
def parse(self, string, name='<string>'):
r =doctest.DocTestParser.parse(self, string, name)
for s in r:
More information about the checkins
mailing list