summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2020-04-22 19:54:01 -0300
committerSoniEx2 <endermoneymod@gmail.com>2020-04-22 19:54:01 -0300
commitfa55f672dfe9e20cadfef5b4ac8bb14a691277f8 (patch)
tree7ad2dca44fad7e072a9cd22250fb11da0d085805
parent124657cfd4d4945dfe471606145472e2c54b0dfd (diff)
Clean up tests a bit more tests-cleanup
-rw-r--r--testing/test_abdl.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/testing/test_abdl.py b/testing/test_abdl.py
index 0307623..d28658a 100644
--- a/testing/test_abdl.py
+++ b/testing/test_abdl.py
@@ -25,23 +25,19 @@ objtree = st.deferred(lambda: st.text() | st.dictionaries(hashables, values) | s
 # note: use all() so as to not eat all the RAM :p
 
 class LogAndCompare:
-    def __init__(self, left, right):
+    def __init__(self, *iterables):
         self.log = []
-        self.iter = self.genny(left, right)
-    def genny(self, left, right):
+        self._iters = iterables
+    def __iter__(self):
         def wrap_exc(it):
             try:
                 for x in it:
                     yield x
             except abdl.ValidationError as e:
                 yield e
-        for (l, r) in itertools.zip_longest(wrap_exc(left), wrap_exc(right), fillvalue=object()):
-            self.log.append((l, r))
-            yield l == r or (type(l), type(r)) == (abdl.ValidationError,)*2
-    def __iter__(self):
-        return self
-    def __next__(self):
-        return next(self.iter)
+        for res in itertools.zip_longest(*map(wrap_exc, self._iters), fillvalue=object()):
+            self.log.append(res)
+            yield all(x == res[0] for x in res) or all(type(x) == abdl.ValidationError for x in res)
     def __repr__(self):
         return "<LogAndCompare(log=" + repr(self.log) + ")>"