From: philipp Date: Sun, 8 Sep 2013 21:22:45 +0000 (+0000) Subject: Added test case for new function find_tag. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wrpylib.git/commitdiff_plain/65fd4f767aa95e8da1ff83c16f82223740611fd6?ds=sidebyside Added test case for new function find_tag. git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@1541 7aebc617-e5e2-0310-91dc-80fb5f6d2477 --- diff --git a/tests/test_mwmarkup.py b/tests/test_mwmarkup.py index df3eb01..3d8c2cb 100644 --- a/tests/test_mwmarkup.py +++ b/tests/test_mwmarkup.py @@ -82,6 +82,19 @@ def test_create_template(): assert wikitext_generated == wikitext +def test_find_tag(): + wikitext = u'This is my first tag and my second tag.' + start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tags') + assert (start, content, endtag, end) == (None, None, None, None) + start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tag') + assert (start, content, endtag, end) == (8, 13, 25, 31) + start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tag', end) + assert (start, content, endtag, end) == (36, 41, 54, 60) + wikitext = u'This is .' + start, content, endtag, end = wrpylib.mwmarkup.find_tag(wikitext, u'tag') + assert (start, content, endtag, end) == (8, None, None, 27) + + def test_parse_googlemap(): wikitext = u'''