parent
38f7562c7c
commit
33c0b06fdf
|
@ -7,6 +7,10 @@
|
||||||
subtle bugs (`#2078`_).
|
subtle bugs (`#2078`_).
|
||||||
Thanks `@nicoddemus`_ for the PR.
|
Thanks `@nicoddemus`_ for the PR.
|
||||||
|
|
||||||
|
* Fix error message using ``approx`` with complex numbers (`#2082`_).
|
||||||
|
Thanks `@adler-j`_ for the report and `@nicoddemus`_ for the PR.
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
* Cope gracefully with a .pyc file with no matching .py file (`#2038`_). Thanks
|
* Cope gracefully with a .pyc file with no matching .py file (`#2038`_). Thanks
|
||||||
`@nedbat`_.
|
`@nedbat`_.
|
||||||
|
@ -15,10 +19,12 @@
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
|
.. _@adler-j: https://github.com/adler-j
|
||||||
.. _@nedbat: https://github.com/nedbat
|
.. _@nedbat: https://github.com/nedbat
|
||||||
|
|
||||||
.. _#2038: https://github.com/pytest-dev/pytest/issues/2038
|
.. _#2038: https://github.com/pytest-dev/pytest/issues/2038
|
||||||
.. _#2078: https://github.com/pytest-dev/pytest/issues/2078
|
.. _#2078: https://github.com/pytest-dev/pytest/issues/2078
|
||||||
|
.. _#2082: https://github.com/pytest-dev/pytest/issues/2082
|
||||||
|
|
||||||
|
|
||||||
3.0.4
|
3.0.4
|
||||||
|
|
|
@ -1419,6 +1419,9 @@ class ApproxNonIterable(object):
|
||||||
self.rel = rel
|
self.rel = rel
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
if isinstance(self.expected, complex):
|
||||||
|
return str(self.expected)
|
||||||
|
|
||||||
# Infinities aren't compared using tolerances, so don't show a
|
# Infinities aren't compared using tolerances, so don't show a
|
||||||
# tolerance.
|
# tolerance.
|
||||||
if math.isinf(self.expected):
|
if math.isinf(self.expected):
|
||||||
|
|
|
@ -28,6 +28,7 @@ class TestApprox:
|
||||||
print(approx(inf))
|
print(approx(inf))
|
||||||
print(approx(1.0, rel=nan))
|
print(approx(1.0, rel=nan))
|
||||||
print(approx(1.0, rel=inf))
|
print(approx(1.0, rel=inf))
|
||||||
|
print(approx(1.0j, rel=inf))
|
||||||
|
|
||||||
def test_operator_overloading(self):
|
def test_operator_overloading(self):
|
||||||
assert 1 == approx(1, rel=1e-6, abs=1e-12)
|
assert 1 == approx(1, rel=1e-6, abs=1e-12)
|
||||||
|
|
Loading…
Reference in New Issue