http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11661
Revision: 11661 Author: legoktm Date: 2013-06-18 07:23:06 +0000 (Tue, 18 Jun 2013) Log Message: ----------- Add a unit test to verify datatype and the datavalue formatter
Modified Paths: -------------- branches/rewrite/tests/page_tests.py
Modified: branches/rewrite/tests/page_tests.py =================================================================== --- branches/rewrite/tests/page_tests.py 2013-06-18 06:57:42 UTC (rev 11660) +++ branches/rewrite/tests/page_tests.py 2013-06-18 07:23:06 UTC (rev 11661) @@ -310,6 +310,10 @@ prop = pywikibot.PropertyPage(repo, 'Property:P21') self.assertEqual(prop.getType(), 'wikibase-item') self.assertEqual(prop.namespace(), 120) + claim = pywikibot.Claim(repo, 'p21') + self.assertRaises(ValueError, claim.setTarget, value="test") + claim.setTarget(pywikibot.ItemPage(repo, 'q1')) + self.assertEqual(claim._formatDataValue(), {'entity-type': 'item', 'numeric-id': 1})
def testItemPageExtensionability(self): class MyItemPage(pywikibot.ItemPage):
pywikipedia-svn@lists.wikimedia.org