Lokal Profil has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/271489

Change subject: Add external identifier test to wikibase_tests.py
......................................................................

Add external identifier test to wikibase_tests.py

A follow-up to I7fd4f5f4bba8a4eb2f83b8b093eb2faf2e64f811 now that
there are external identifier properties on Wikidata.

Also renames variables in test_set_incorrect_target_value() to make
it clearer which type is being tested.

Change-Id: I145de5835bb600330700e1bab92daeadefe35786
---
M tests/wikibase_tests.py
1 file changed, 14 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/89/271489/1

diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 2c841ba..164bbd9 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -669,6 +669,14 @@
         claim.setTarget('a^2 + b^2 = c^2')
         self.assertEqual(claim.target, 'a^2 + b^2 = c^2')
 
+    def test_set_identifier(self):
+        """Test setting claim of external-id type."""
+        wikidata = self.get_repo()
+        claim = pywikibot.Claim(wikidata, 'P214')
+        self.assertEqual(claim.type, 'external-id')
+        claim.setTarget('Any string is avalid identifier')
+        self.assertEqual(claim.target, 'Any string is avalid identifier')
+
     def test_set_date(self):
         """Test setting claim of time type."""
         wikidata = self.get_repo()
@@ -682,12 +690,12 @@
     def test_set_incorrect_target_value(self):
         """Test setting claim of the incorrect value."""
         wikidata = self.get_repo()
-        claim = pywikibot.Claim(wikidata, 'P569')
-        self.assertRaises(ValueError, claim.setTarget, 'foo')
-        claim = pywikibot.Claim(wikidata, 'P856')
-        self.assertRaises(ValueError, claim.setTarget, pywikibot.WbTime(2001, 
site=wikidata))
-        claim = pywikibot.Claim(wikidata, 'P1450')
-        self.assertRaises(ValueError, claim.setTarget, 'foo')
+        date_claim = pywikibot.Claim(wikidata, 'P569')
+        self.assertRaises(ValueError, date_claim.setTarget, 'foo')
+        url_claim = pywikibot.Claim(wikidata, 'P856')
+        self.assertRaises(ValueError, url_claim.setTarget, 
pywikibot.WbTime(2001, site=wikidata))
+        mono_claim = pywikibot.Claim(wikidata, 'P1450')
+        self.assertRaises(ValueError, mono_claim.setTarget, 'foo')
 
 
 class TestItemBasePageMethods(WikidataTestCase, BasePageMethodsTestBase):

-- 
To view, visit https://gerrit.wikimedia.org/r/271489
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I145de5835bb600330700e1bab92daeadefe35786
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to