1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[tests] swap assertEqual argument order

before this, it would show test failures as
+ test value
- extracted value
when it should be the other way round
This commit is contained in:
Mike Fährmann 2023-11-27 01:02:39 +01:00
parent 9f3368c46f
commit 95c1dfb089
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -192,22 +192,22 @@ class TestExtractorResults(unittest.TestCase):
subtest = True
self._test_kwdict(value[idx], item)
if not subtest:
self.assertEqual(value, test, msg=key)
self.assertEqual(test, value, msg=key)
elif isinstance(test, str):
if test.startswith("re:"):
self.assertRegex(value, test[3:], msg=key)
elif test.startswith("dt:"):
self.assertIsInstance(value, datetime.datetime, msg=key)
self.assertEqual(str(value), test[3:], msg=key)
self.assertEqual(test[3:], str(value), msg=key)
elif test.startswith("type:"):
self.assertEqual(type(value).__name__, test[5:], msg=key)
self.assertEqual(test[5:], type(value).__name__, msg=key)
elif test.startswith("len:"):
self.assertIsInstance(value, (list, tuple), msg=key)
self.assertEqual(len(value), int(test[4:]), msg=key)
self.assertEqual(int(test[4:]), len(value), msg=key)
else:
self.assertEqual(value, test, msg=key)
self.assertEqual(test, value, msg=key)
else:
self.assertEqual(value, test, msg=key)
self.assertEqual(test, value, msg=key)
class ResultJob(job.DownloadJob):