Skip to content

Commit 1f5d4fb

Browse files
committed
TST: add different lenghts iterables test
1 parent 1916a60 commit 1f5d4fb

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

scipy_doctest/tests/failure_cases.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
__all__ = ['func9', 'func10']
1+
__all__ = ['func9', 'func10', 'iterable_length_1', 'iterable_length_2']
2+
23

34
def func9():
45
"""
@@ -15,3 +16,17 @@ def func10():
1516
>>> import numpy as np
1617
>>> np.arraY([1, 2, 3])
1718
"""
19+
20+
21+
def iterable_length_1():
22+
"""
23+
>>> [1, 2, 3]
24+
[1, 2, 3, 4]
25+
"""
26+
27+
28+
def iterable_length_2():
29+
"""
30+
>>> [1, 2, 3]
31+
[1, 2]
32+
"""

scipy_doctest/tests/test_testmod.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ def test_user_context():
9999
config=config)
100100

101101

102+
def test_wrong_lengths():
103+
config = DTConfig()
104+
res, _ = _testmod(failure_cases,
105+
strategy=[failure_cases.iterable_length_1,
106+
failure_cases.iterable_length_2],
107+
config=config)
108+
assert res.failed == 2
109+
110+
102111
class TestLocalFiles:
103112
def test_local_files(self):
104113
# A doctest tries to open a local file. Test that it works

0 commit comments

Comments
 (0)