forked from pool/python-pytest-doctestplus
* Avoid SyntaxWarning regarding invalid escape sequence in Python 3.9. [#62] * Compatibility with pytest 5.1 to avoid AttributeError caused by FixtureRequest. [#63] - Drop merged patch: * merged_pr_63.patch - Rebase patch: * pr_37.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-doctestplus?expand=0&rev=11
47 lines
1.7 KiB
Diff
47 lines
1.7 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
|
|
|
|
Index: pytest-doctestplus-0.4.0/pytest_doctestplus/output_checker.py
|
|
===================================================================
|
|
--- pytest-doctestplus-0.4.0.orig/pytest_doctestplus/output_checker.py
|
|
+++ pytest-doctestplus-0.4.0/pytest_doctestplus/output_checker.py
|
|
@@ -6,8 +6,7 @@ normalizations of Python expression outp
|
|
|
|
import doctest
|
|
import re
|
|
-
|
|
-import numpy as np
|
|
+import math
|
|
|
|
import six
|
|
from six.moves import zip
|
|
@@ -125,8 +124,10 @@ class OutputChecker(doctest.OutputChecke
|
|
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".
|
|
Index: pytest-doctestplus-0.4.0/setup.py
|
|
===================================================================
|
|
--- pytest-doctestplus-0.4.0.orig/setup.py
|
|
+++ pytest-doctestplus-0.4.0/setup.py
|
|
@@ -40,7 +40,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': [
|