Lokal Profil has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/349178 )
Change subject: Replace homemade assertion with assertLessEqual
......................................................................
Replace homemade assertion with assertLessEqual
The custom asseration has been kept as a wrapper which changes the
error message to somehting more useful.
Change-Id: Ife3607a79f746f3811378bbd906d7d43463e2943
---
M tests/custom_assertions.py
1 file changed, 5 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/labs/tools/heritage
refs/changes/78/349178/1
diff --git a/tests/custom_assertions.py b/tests/custom_assertions.py
index 8a9a1e1..6f40acc 100644
--- a/tests/custom_assertions.py
+++ b/tests/custom_assertions.py
@@ -15,13 +15,11 @@
error_msg = msg
else:
error_msg = u'%s: %s' % (msg, error_msg)
- failing = []
- for i in first:
- try:
- self.assertIn(i, second, msg=msg)
- except AssertionError:
- failing.append(i)
- self.assertEqual(failing, [], msg=error_msg % ', '.join(failing))
+ try:
+ self.assertLessEqual(set(first), set(second))
+ except AssertionError:
+ diff = set(first) - set(second)
+ raise AssertionError(error_msg % ', '.join(diff))
def assert_is_ascii(self, text, msg=None):
"""Assert that a string is ascii."""
--
To view, visit https://gerrit.wikimedia.org/r/349178
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife3607a79f746f3811378bbd906d7d43463e2943
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/heritage
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits