[PATCH 1 of 2] templatefilters: add doctests for person

Adrian Buehlmann adrian at cadifra.com
Mon Apr 18 05:03:17 CDT 2011


On 2011-04-18 11:49, Martin Geisler wrote:
> Adrian Buehlmann <adrian at cadifra.com> writes:
> 
>> On 2011-04-17 22:32, Adrian Buehlmann wrote:
>>> # HG changeset patch
>>> # User Adrian Buehlmann <adrian at cadifra.com>
>>> # Date 1303068865 -7200
>>> # Node ID 989a7f3abceb143a547f17e7520863d8124052f1
>>> # Parent  d66272d05c8ab8dd4dd6f392d2e5820d7c417db8
>>> templatefilters: add doctests for person
>>>
>>> diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
>>> --- a/mercurial/templatefilters.py
>>> +++ b/mercurial/templatefilters.py
>>> @@ -241,7 +241,12 @@
>>>      return "-rw-r--r--"
>>>  
>>>  def person(author):
>>> -    """:person: Any text. Returns the text before an email address."""
>>> +    """:person: Any text. Returns the text before an email address.
>>> +    >>> person('John Doe <john at example.com>')
>>> +    'John Doe'
>>> +    >>> person('john.doe at example.com')
>>> +    'john'
>>> +    """
>>
>> $ hg help templates
>> ...
>>     person      Any text. Returns the text before an email address. >>>
>>                 person('John Doe <john at example.com>') 'John Doe' >>>
>>                 person('john.doe at example.com') 'john doe'
>>
>> seems not pleased about doctests there. I need to figure out how to fix
>> that.
>>
>> <joking>But in some ways, it's funny. Like that, we would have tested
>> examples in the help text (ping parren :-).
> 
> Yeah, that could be neat. However, here the right way to fix this is not
> to let help.py remove the doctests but instead teach minirst about them.

What the heck is minirst?

This is way too complicated for what I wanted to accomplish, so I'll
give up on this doctest business and send the changes I want without the
doctest.


More information about the Mercurial-devel mailing list