+++ /dev/null
-#!/usr/bin/python3.4
-# $Id$
-# $HeadURL$
-import unittest
-from wrpylib.mwapi import dbkey_to_title
-
-
-class TestMwApi(unittest.TestCase):
- def test_dbkey_to_title(self):
- self.assertEqual(dbkey_to_title('My_Title'), 'My Title')
- self.assertEqual(dbkey_to_title('My Title'), 'My Title') # should not happen
- self.assertEqual(dbkey_to_title('My_nice_Title'), 'My nice Title')
value = mwparserfromhell.parse('{{ my_template || | var = 7 }}').filter_templates()[0]
wrpylib.mwmarkup.format_template_oneline(value)
self.assertEqual('{{my_template| | |var=7}}', value)
+
+
+class TestMwApi(unittest.TestCase):
+ def test_dbkey_to_title(self):
+ self.assertEqual(wrpylib.mwmarkup.dbkey_to_title('My_Title'), 'My Title')
+ self.assertEqual(wrpylib.mwmarkup.dbkey_to_title('My Title'), 'My Title') # should not happen
+ self.assertEqual(wrpylib.mwmarkup.dbkey_to_title('My_nice_Title'), 'My nice Title')
+++ /dev/null
-#!/usr/bin/python3.4
-# $Id$
-# $HeadURL$
-"""This module contains general functions for using the MediaWiki API. There is one very
-good Python wrapper implementation of the MediaWiki API:
-* wikitools http://code.google.com/p/python-wikitools/
-
-Therefore this module doesn't need to have much content.
-"""
-
-
-def dbkey_to_title(value):
- """Converts a article database key to a article title. Private function secureAndSplit() of the Title class
- on line 3316 of includes/Title.php says:
- $this->mTextform = str_replace( '_', ' ', $this->mDbkeyform );
- No check for None because a missing title is an error."""
- return value.replace('_', ' ')
if value == '':
value = ' '
param.value = value
+
+
+def dbkey_to_title(value):
+ """Converts a article database key to a article title. Private function secureAndSplit() of the Title class
+ on line 3316 of includes/Title.php says:
+ $this->mTextform = str_replace( '_', ' ', $this->mDbkeyform );
+ No check for None because a missing title is an error."""
+ return value.replace('_', ' ')