Skip to content

Commit

Permalink
add tests for #28
Browse files Browse the repository at this point in the history
  • Loading branch information
Technologicat committed Nov 13, 2021
1 parent 6398c71 commit c83cb60
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions mcpyrate/test/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,36 @@ def testmacro(tree, **kw):
pass
test_dynamicmodule_multiphase()

def test_futureimports_multiphase_nodocstring():
try:
with q as quoted:
from __future__ import annotations
from mcpyrate.multiphase import macros, phase
with phase[1]:
x = 42
module = run(quoted)
finally:
try:
del sys.modules[module.__name__]
except KeyError:
pass
test_futureimports_multiphase_nodocstring()

def test_futureimports_multiphase_withdocstring():
try:
with q as quoted:
"""Works with a module docstring, too."""
from __future__ import annotations
from mcpyrate.multiphase import macros, phase
with phase[1]:
x = 42
module = run(quoted)
finally:
try:
del sys.modules[module.__name__]
except KeyError:
pass
test_futureimports_multiphase_withdocstring()

if __name__ == '__main__':
runtests()

0 comments on commit c83cb60

Please sign in to comment.