view MoinMoin/converter/_tests/test__args_wiki.py @ 1974:87272c032485

remove unused imports
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 10 Feb 2013 23:54:13 +0100
parents 4ac437141bbe
children 181a556a0920
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
"""


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