[Pywikibot-commits] [Gerrit] ...core[master]: [test] Fix User.usercontribs test

2022-11-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/854548 )

Change subject: [test] Fix User.usercontribs test
..

[test] Fix User.usercontribs test

Change-Id: I74b74ceaa6066548ad7a5eb413bc21741703b22b
---
M tests/user_tests.py
1 file changed, 4 insertions(+), 3 deletions(-)

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



diff --git a/tests/user_tests.py b/tests/user_tests.py
index 0488dca..81c8443 100755
--- a/tests/user_tests.py
+++ b/tests/user_tests.py
@@ -173,15 +173,16 @@

 def test_contribution(self):
 """Test the User.usercontribs() method."""
+total = 50
 mysite = self.get_site()
 user = User(mysite, mysite.user())
-uc = list(user.contributions(total=50))
+uc = list(user.contributions(total=total))
 if not uc:
 self.skipTest('User {} has no contributions on site {}.'
   .format(mysite.user(), mysite))
-self.assertLessEqual(len(uc), 10)
+self.assertLessEqual(len(uc), total)
 self.assertEqual(uc[0], user.last_edit)
-first_edit = uc[-1] if len(uc) < 50 else list(
+first_edit = uc[-1] if len(uc) < total else list(
 user.contributions(total=1, reverse=True))[0]
 self.assertEqual(first_edit, user.first_edit)
 for contrib in uc:

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/854548
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: I74b74ceaa6066548ad7a5eb413bc21741703b22b
Gerrit-Change-Number: 854548
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [test] Fix User.usercontribs test

2022-11-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/854152 )

Change subject: [test] Fix User.usercontribs test
..

[test] Fix User.usercontribs test

Change-Id: I8c7ce01bc24bb637d72012412f6544ed7b323b37
---
M tests/user_tests.py
1 file changed, 4 insertions(+), 2 deletions(-)

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



diff --git a/tests/user_tests.py b/tests/user_tests.py
index 2b35e1d..0488dca 100755
--- a/tests/user_tests.py
+++ b/tests/user_tests.py
@@ -175,13 +175,15 @@
 """Test the User.usercontribs() method."""
 mysite = self.get_site()
 user = User(mysite, mysite.user())
-uc = list(user.contributions(total=10))
+uc = list(user.contributions(total=50))
 if not uc:
 self.skipTest('User {} has no contributions on site {}.'
   .format(mysite.user(), mysite))
 self.assertLessEqual(len(uc), 10)
 self.assertEqual(uc[0], user.last_edit)
-self.assertEqual(uc[-1], user.first_edit)
+first_edit = uc[-1] if len(uc) < 50 else list(
+user.contributions(total=1, reverse=True))[0]
+self.assertEqual(first_edit, user.first_edit)
 for contrib in uc:
 self.assertIsInstance(contrib, tuple)
 self.assertLength(contrib, 4)

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/854152
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: I8c7ce01bc24bb637d72012412f6544ed7b323b37
Gerrit-Change-Number: 854152
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org