mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Convert to float for comparison with float in IFDRational __eq__
This commit is contained in:
parent
ef22a740eb
commit
c04260b3f5
|
@ -28,6 +28,8 @@ def test_sanity():
|
|||
_test_equal(1, 2, Fraction(1, 2))
|
||||
_test_equal(1, 2, IFDRational(1, 2))
|
||||
|
||||
_test_equal(7, 5, 1.4)
|
||||
|
||||
|
||||
def test_ranges():
|
||||
for num in range(1, 10):
|
||||
|
|
|
@ -354,9 +354,12 @@ class IFDRational(Rational):
|
|||
return self._val.__hash__()
|
||||
|
||||
def __eq__(self, other):
|
||||
val = self._val
|
||||
if isinstance(other, IFDRational):
|
||||
other = other._val
|
||||
return self._val == other
|
||||
if isinstance(other, float):
|
||||
val = float(val)
|
||||
return val == other
|
||||
|
||||
def __getstate__(self):
|
||||
return [self._val, self._numerator, self._denominator]
|
||||
|
|
Loading…
Reference in New Issue
Block a user