Skip to content

Commit 4096ed7

Browse files
committed
Add test for pyf
1 parent 83691f5 commit 4096ed7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/Python/Inline/QQ.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pye = QuasiQuoter
6060
-- call return
6161
pyf :: QuasiQuoter
6262
pyf = QuasiQuoter
63-
{ quoteExp = \txt -> [| runPy $ evalutorPyf $(expQQ Fun txt) |]
63+
{ quoteExp = \txt -> [| runPy $ evaluatorPyf $(expQQ Fun txt) |]
6464
, quotePat = error "quotePat"
6565
, quoteType = error "quoteType"
6666
, quoteDec = error "quoteDec"

test/TST/Run.hs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,26 @@ tests = testGroup "Run python"
8181
except NameError:
8282
pass
8383
|]
84+
, testCase "Scope pyf->any" $ do
85+
_ <- [pyf|
86+
x = 12
87+
x
88+
return 12
89+
|]
90+
-- Not visible
91+
throwsPy $ void [pye| x |]
92+
[py_|
93+
try:
94+
x
95+
assert False, "x shouln't be visible (1)"
96+
except NameError:
97+
pass
98+
|]
99+
[pymain|
100+
try:
101+
x
102+
assert False, "x shouln't be visible (2)"
103+
except NameError:
104+
pass
105+
|]
84106
]

0 commit comments

Comments
 (0)