Moved dbkey_to_title from mwapi to mwmarkup.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 29 Jan 2017 22:19:13 +0000 (22:19 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 29 Jan 2017 22:19:13 +0000 (22:19 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2636 7aebc617-e5e2-0310-91dc-80fb5f6d2477

tests/test_mwapi.py [deleted file]
tests/test_mwmarkup.py
wrpylib/mwapi.py [deleted file]
wrpylib/mwmarkup.py

diff --git a/tests/test_mwapi.py b/tests/test_mwapi.py
deleted file mode 100644 (file)
index a3ed4bc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/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')
index 9955656d592b31e2361e52c42a1ae39173e50e22..41225f13a1d2bc733712d7e402f20e13e90ea2f1 100644 (file)
@@ -147,3 +147,10 @@ class TestFormatTemplate(unittest.TestCase):
         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')
diff --git a/wrpylib/mwapi.py b/wrpylib/mwapi.py
deleted file mode 100644 (file)
index 5686c47..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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('_', ' ')
index 04c2ffaf78d5a362bd3f4b37ea2ca7ef3e24b5a7..221f1cb31979131595495de6c46c98474ed87b4a 100644 (file)
@@ -53,3 +53,11 @@ def format_template_oneline(template):
         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('_', ' ')