Skip to content

Commit 53e16f7

Browse files
committed
Added Failed Import Test
1 parent 19665d9 commit 53e16f7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/test_plugin.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_inline_detects_from_imports(self, pytester: Pytester):
7474
class Choice(Enum):
7575
YES = 0
7676
NO = 1
77-
77+
7878
def m(a):
7979
b = a
8080
itest().given(a, Choice.YES).check_eq(b, Choice.YES)
@@ -86,6 +86,21 @@ def m(a):
8686
res = pytester.runpytest()
8787
assert res.ret == 0
8888

89+
def test_fail_on_importing_missing_module(self, pytester: Pytester):
90+
checkfile = pytester.makepyfile(
91+
"""
92+
from inline import itest
93+
from scipy import owijef as st
94+
95+
def m(n, p):
96+
b = st.binom(n, p)
97+
itest().given(n, 100).given(p, 0.5).check_eq(b.mean(), n * p)
98+
"""
99+
)
100+
for x in (pytester.path, checkfile):
101+
items, reprec = pytester.inline_genitems(x)
102+
assert len(items) == 0
103+
89104
def test_inline_malformed_given(self, pytester: Pytester):
90105
checkfile = pytester.makepyfile(
91106
"""

0 commit comments

Comments
 (0)