moin-2.0 / build / lib / MoinMoin / converter / _tests / test__args_wiki.py

# 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.