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

[util] let a CustomNone instance be equal to itself

This commit is contained in:
Mike Fährmann 2024-07-26 20:56:01 +02:00
parent 8ecd408f53
commit d7a2c73274
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 9 additions and 4 deletions

View File

@ -540,10 +540,14 @@ class CustomNone():
def __bool__():
return False
def __eq__(self, other):
return self is other
def __ne__(self, other):
return self is not other
__lt__ = true
__le__ = true
__eq__ = false
__ne__ = true
__gt__ = false
__ge__ = false

View File

@ -755,8 +755,9 @@ def hash(value):
self.assertLess(obj, "foo")
self.assertLessEqual(obj, None)
self.assertFalse(obj == obj)
self.assertTrue(obj != obj)
self.assertTrue(obj == obj)
self.assertFalse(obj == 0)
self.assertFalse(obj != obj)
self.assertGreater(123, obj)
self.assertGreaterEqual(1.23, obj)