http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11736
Revision: 11736 Author: legoktm Date: 2013-07-10 05:46:56 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Add a few tests for textlib.extract_templates_and_params
Modified Paths: -------------- branches/rewrite/tests/textlib_tests.py
Modified: branches/rewrite/tests/textlib_tests.py =================================================================== --- branches/rewrite/tests/textlib_tests.py 2013-07-10 03:43:29 UTC (rev 11735) +++ branches/rewrite/tests/textlib_tests.py 2013-07-10 05:46:56 UTC (rev 11736) @@ -33,6 +33,13 @@ def testCurrentBehaviour(self): self.assertContains("enwiki_help_editing", u"Editing")
+ def testExtractTemplates(self): + func = textlib.extract_templates_and_params # It's really long. + self.assertEqual(func('{{a}}'), [('a', {})]) + self.assertEqual(func('{{a|b=c}}'), [('a', {'b': 'c'})]) + self.assertEqual(func('{{a|b|c=d}}'), [('a', {u'1': 'b', 'c': 'd'})]) + + @unittest.expectedFailure def testSpacesInSection(self): self.assertContains("enwiki_help_editing", u"Minor_edits")