mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Reverted NaN change, so that NaN != NaN
This commit is contained in:
parent
4bb35c57dd
commit
0a46cbfea9
|
@ -30,7 +30,6 @@ def test_sanity():
|
||||||
|
|
||||||
|
|
||||||
def test_ranges():
|
def test_ranges():
|
||||||
|
|
||||||
for num in range(1, 10):
|
for num in range(1, 10):
|
||||||
for denom in range(1, 10):
|
for denom in range(1, 10):
|
||||||
assert IFDRational(num, denom) == IFDRational(num, denom)
|
assert IFDRational(num, denom) == IFDRational(num, denom)
|
||||||
|
@ -50,12 +49,6 @@ def test_nonetype():
|
||||||
assert xres and yres
|
assert xres and yres
|
||||||
|
|
||||||
|
|
||||||
def test_nan():
|
|
||||||
# usually NaN != NaN, but this would break exif self-equality
|
|
||||||
|
|
||||||
assert IFDRational(123, 0) == IFDRational(123, 0)
|
|
||||||
|
|
||||||
|
|
||||||
def test_ifd_rational_save(tmp_path):
|
def test_ifd_rational_save(tmp_path):
|
||||||
methods = (True, False)
|
methods = (True, False)
|
||||||
if not features.check("libtiff"):
|
if not features.check("libtiff"):
|
||||||
|
|
|
@ -354,12 +354,8 @@ class IFDRational(Rational):
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if isinstance(other, IFDRational):
|
if isinstance(other, IFDRational):
|
||||||
if self.denominator == 0 and other.denominator == 0:
|
other = other._val
|
||||||
# in this case self._val and other._val would be NaN
|
return self._val == other
|
||||||
return self.numerator == other.numerator
|
|
||||||
return self._val == other._val
|
|
||||||
else:
|
|
||||||
return self._val == other
|
|
||||||
|
|
||||||
def _delegate(op):
|
def _delegate(op):
|
||||||
def delegate(self, *args):
|
def delegate(self, *args):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user