diff --git a/gallery_dl/util.py b/gallery_dl/util.py index f31e7f30..fb6d3771 100644 --- a/gallery_dl/util.py +++ b/gallery_dl/util.py @@ -681,10 +681,10 @@ class CustomNone(): raise StopIteration def __eq__(self, other): - return self is other + return other is self or other is None def __ne__(self, other): - return self is not other + return other is not self and other is not None __lt__ = true __le__ = true diff --git a/test/test_util.py b/test/test_util.py index d5f156bb..6613898b 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -882,6 +882,12 @@ value = 123 obj = util.NONE self.assertFalse(obj) + self.assertEqual(obj, obj) + self.assertEqual(obj, None) + self.assertNotEqual(obj, False) + self.assertNotEqual(obj, 0) + self.assertNotEqual(obj, "") + self.assertEqual(len(obj), 0) self.assertEqual(int(obj), 0) self.assertEqual(hash(obj), 0)