view MoinMoin/converter/_tests/ @ 1364:582e7109a8c1

mass update - delete trailing spaces and/or add blank line to end of file
author Roger Haase <>
date Wed, 06 Jun 2012 15:03:07 -0700
parents 17931e46e2df
children 4ac437141bbe
line wrap: on
line source
# Copyright: 2008 MoinMoin:BastianBlank
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

MoinMoin - Tests for MoinMoin.converter._args_wiki

import pytest

from MoinMoin.converter._args_wiki import *

def test():
    yield (do,
        ur'both positional both=foo keyword=bar',
        [u'both', u'positional'],
        {u'both': u'foo', u'keyword': u'bar'})

    yield (do,
        ur'a-b a_b a-c=foo a_c=bar',
        [u'a-b', u'a_b'],
        {u'a-c': u'foo', u'a_c': u'bar'})

    yield (do,
        ur'''"a b\tc\nd" k="a b\tc\nd"''',
        [u'a b\tc\nd'],
        {u'k': u'a b\tc\nd'})

def test_parse():
    a = parse(ur''''a b\tc\nd',k="a b\tc\nd"''')
    assert a.positional == [u'a b\tc\nd']
    assert a.keyword == {u'k': u'a b\tc\nd'}

def do(wiki, positional, keyword):
    a = parse(wiki)
    assert a.positional == positional
    assert a.keyword == keyword

    s = unparse(Arguments(positional, keyword))
    assert s == wiki