[PATCH 1 of 2] templatefilters: add doctests for person
Martin Geisler
mg at lazybytes.net
Mon Apr 18 06:37:35 CDT 2011
Adrian Buehlmann <adrian at cadifra.com> writes:
> 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?
It is mercurial/minirst.py -- the small reST engine we use to transform
reStructuredText into ASCII-art. The idea is that reST is already so
close to pure ASCII text that we can just post-process it a little
before we display it in the terminal.
> 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.
Yeah, I think that is best too.
--
Martin Geisler
Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110418/d7c0f865/attachment.pgp>
More information about the Mercurial-devel
mailing list