Mpaa has uploaded a new change for review.

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

Change subject: Solve usage of expectedFailure for tools_tests.py
......................................................................

Solve usage of expectedFailure for tools_tests.py

Bug: T129368
Change-Id: I60a6398f78d3f3dedea8073fa355662eef443cb9
---
M tests/tools_tests.py
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/56/278456/1

diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index 2d0935e..8dc1ea8 100644
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -409,13 +409,15 @@
         deduper = tools.filter_unique(self.decs, container=deduped, key=hash)
         self._test_dedup_int(deduped, deduper, hash)
 
-    @unittest.expectedFailure
     def test_obj_id(self):
         """Test filter_unique with objects using id as key, which fails."""
         # Two objects which may be equal do not have the same id.
-        deduped = set()
-        deduper = tools.filter_unique(self.decs, container=deduped, key=id)
-        self._test_dedup_int(deduped, deduper, id)
+        # No. of Decimal objects with distinct ids != no. of equal Decimal 
objects.
+        deduper_id = list(tools.filter_unique(self.decs, key=id))
+        self.assertNotEqual(len(deduper_id), len(set(deduper_id)))
+        # Filtering by value yields the same no. of items.
+        deduper_int = list(tools.filter_unique(self.decs, key=int))
+        self.assertEqual(len(deduper_int), len(set(deduper_int)))
 
     def test_str(self):
         """Test filter_unique with str."""

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

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

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

Reply via email to