forked from pool/python-pytest-doctestplus
47 lines
1.5 KiB
Diff
47 lines
1.5 KiB
Diff
|
|
commit 898d66c7eeabddf5d17bb899c8beebe5aad2c4ee
|
||
|
|
Author: Oscar Benjamin <oscar.j.benjamin@gmail.com>
|
||
|
|
Date: Thu Jan 3 17:15:04 2019 +0000
|
||
|
|
|
||
|
|
Inline np.allclose to remove dependency on numpy
|
||
|
|
|
||
|
|
diff --git a/pytest_doctestplus/output_checker.py b/pytest_doctestplus/output_checker.py
|
||
|
|
index e77e2ec..b889b1c 100644
|
||
|
|
--- a/pytest_doctestplus/output_checker.py
|
||
|
|
+++ b/pytest_doctestplus/output_checker.py
|
||
|
|
@@ -6,8 +6,7 @@ normalizations of Python expression output. See the docstring on
|
||
|
|
|
||
|
|
import doctest
|
||
|
|
import re
|
||
|
|
-
|
||
|
|
-import numpy as np
|
||
|
|
+import math
|
||
|
|
|
||
|
|
import six
|
||
|
|
from six.moves import zip
|
||
|
|
@@ -125,8 +124,10 @@ class OutputChecker(doctest.OutputChecker):
|
||
|
|
else:
|
||
|
|
nw_.append(nw)
|
||
|
|
|
||
|
|
- if not np.allclose(float(ng), float(nw), rtol=self.rtol,
|
||
|
|
- atol=self.atol, equal_nan=True):
|
||
|
|
+ ng = float(ng)
|
||
|
|
+ nw = float(nw)
|
||
|
|
+ if not (abs(ng - nw) <= self.atol + self.rtol * abs(nw)
|
||
|
|
+ or (math.isnan(ng) and math.isnan(nw))):
|
||
|
|
return False
|
||
|
|
|
||
|
|
# replace all floats in the "got" string by those from "wanted".
|
||
|
|
diff --git a/setup.py b/setup.py
|
||
|
|
index 6513c57..463f382 100755
|
||
|
|
--- a/setup.py
|
||
|
|
+++ b/setup.py
|
||
|
|
@@ -48,7 +48,7 @@ setup(
|
||
|
|
'Topic :: Utilities',
|
||
|
|
],
|
||
|
|
keywords=[ 'doctest', 'rst', 'pytest', 'py.test' ],
|
||
|
|
- install_requires=[ 'six', 'pytest>=3.0', 'numpy>=1.10' ],
|
||
|
|
+ install_requires=[ 'six', 'pytest>=3.0'],
|
||
|
|
python_requires='>=2.7',
|
||
|
|
entry_points={
|
||
|
|
'pytest11': [
|