jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655524?usp=email )

Change subject: [tests] Add two edit tests for WbTime
......................................................................

[tests] Add two edit tests for WbTime

Adding the tests since I'm getting local "API error modification-failed: 
Malformed input" errors when using fromTimestr

Bug: T325860
Change-Id: I249e949c014455102b2f7c47da6a2bfb7d5eeaa3
---
M tests/wikibase_edit_tests.py
1 file changed, 36 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index d2e9fc5..3d9bb47 100755
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -6,7 +6,7 @@
 class in edit_failiure_tests.py
 """
 #
-# (C) Pywikibot team, 2014-2022
+# (C) Pywikibot team, 2014-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -430,6 +430,41 @@
         claim = item.claims['P88936'][0]
         self.assertEqual(claim.getTarget(), target)

+    def test_WbTime_edit_simple(self):
+        """Attempt adding a WbTime claim with valid input."""
+        testsite = self.get_repo()
+        item = self._clean_item(testsite, 'P66')
+
+        # set new claim
+        claim = pywikibot.page.Claim(
+            testsite, 'P66', datatype='time')
+        target = pywikibot.WbTime(year=2012)
+        claim.setTarget(target)
+        item.addClaim(claim)
+
+        # confirm new claim
+        item.get(force=True)
+        claim = item.claims['P66'][0]
+        self.assertEqual(claim.getTarget(), target)
+
+    @unittest.expectedFailure  # T325860
+    def test_WbTime_edit_fromTimestr(self):
+        """Attempt adding a WbTime claim with valid input."""
+        testsite = self.get_repo()
+        item = self._clean_item(testsite, 'P66')
+
+        # set new claim
+        claim = pywikibot.page.Claim(
+            testsite, 'P66', datatype='time')
+        target = pywikibot.WbTime.fromTimestr('+00000002010-01-01T12:43:01Z')
+        claim.setTarget(target)
+        item.addClaim(claim)
+
+        # confirm new claim
+        item.get(force=True)
+        claim = item.claims['P66'][0]
+        self.assertEqual(claim.getTarget(), target)
+

 class TestWikibaseRemoveQualifier(WikibaseTestCase):


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655524?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I249e949c014455102b2f7c47da6a2bfb7d5eeaa3
Gerrit-Change-Number: 655524
Gerrit-PatchSet: 5
Gerrit-Owner: Lokal Profil <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to