[Pywikipedia-l] SVN: [5360] branches/rewrite/pywikibot/tests/site_tests.py
russblau at svn.wikimedia.org
russblau at svn.wikimedia.org
Mon May 12 20:33:48 UTC 2008
Revision: 5360
Author: russblau
Date: 2008-05-12 20:33:47 +0000 (Mon, 12 May 2008)
Log Message:
-----------
add framework (incomplete) for testing site methods
Added Paths:
-----------
branches/rewrite/pywikibot/tests/site_tests.py
Added: branches/rewrite/pywikibot/tests/site_tests.py
===================================================================
--- branches/rewrite/pywikibot/tests/site_tests.py (rev 0)
+++ branches/rewrite/pywikibot/tests/site_tests.py 2008-05-12 20:33:47 UTC (rev 5360)
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+"""
+Tests for the site module.
+"""
+#
+# (C) Pywikipedia bot team, 2008
+#
+# Distributed under the terms of the MIT license.
+#
+__version__ = '$Id: $'
+
+
+import unittest
+import pywikibot
+
+mysite = pywikibot.Site("en", "wikipedia")
+
+
+class TestSiteObject(unittest.TestCase):
+ """Test cases for Site methods."""
+ def testBaseMethods(self):
+ """Test cases for BaseSite methods"""
+ self.assertEqual(mysite.family(), pywikibot.site.Family("wikipedia"))
+ self.assertEqual(mysite.language(), "en")
+ self.assert_(isinstance(mysite.user(), (basestring, type(None))))
+ self.assertEqual(mysite.sitename(), "wikipedia:en")
+ self.assertEqual(mysite.normalize_namespace("project"), "Wikipedia")
+ self.assertEqual(mysite.redirect(), "REDIRECT")
+
+
+if __name__ == '__main__':
+ try:
+ try:
+ unittest.main()
+ except SystemExit:
+ pass
+ finally:
+ pywikibot.stopme()
More information about the Pywikipedia-l
mailing list