tests: lazily import doctest in approx tests
This commit is contained in:
parent
32412532ef
commit
a5bd19e3b4
|
@ -1,4 +1,3 @@
|
||||||
import doctest
|
|
||||||
import operator
|
import operator
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
|
@ -13,12 +12,14 @@ inf, nan = float("inf"), float("nan")
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mocked_doctest_runner(monkeypatch):
|
def mocked_doctest_runner(monkeypatch):
|
||||||
|
import doctest
|
||||||
|
|
||||||
class MockedPdb:
|
class MockedPdb:
|
||||||
def __init__(self, out):
|
def __init__(self, out):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def set_trace(self):
|
def set_trace(self):
|
||||||
pass
|
raise NotImplementedError("not used")
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
pass
|
pass
|
||||||
|
@ -428,6 +429,8 @@ class TestApprox:
|
||||||
assert a21 != approx(a12)
|
assert a21 != approx(a12)
|
||||||
|
|
||||||
def test_doctests(self, mocked_doctest_runner):
|
def test_doctests(self, mocked_doctest_runner):
|
||||||
|
import doctest
|
||||||
|
|
||||||
parser = doctest.DocTestParser()
|
parser = doctest.DocTestParser()
|
||||||
test = parser.get_doctest(
|
test = parser.get_doctest(
|
||||||
approx.__doc__, {"approx": approx}, approx.__name__, None, None
|
approx.__doc__, {"approx": approx}, approx.__name__, None, None
|
||||||
|
|
Loading…
Reference in New Issue