Skip to content

Commit

Permalink
added testfor indent without body
Browse files Browse the repository at this point in the history
  • Loading branch information
nucccc committed Dec 3, 2023
1 parent 69f2d2d commit 6d391cb
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/test_code_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
some code should be written to actually run tests on the code process
'''

from markarth.convert.preprocess.code_process import func_codelines
import pytest

from markarth.convert.preprocess.code_process import (
func_codelines,
process_code,
indentation_pattern,
ASTWithoutBody
)
from markarth.convert.collect.mod_collect import collect_func_defs


Expand Down Expand Up @@ -44,4 +51,14 @@ def test_func_codelines(mod3):
' c = f2()',
' res = c * g',
' return res'
]
]


def test_indentation_pattern_ast_without_body():
code = '''a = 0'''

ast_nodes, codelines = process_code(code)
func_ast = ast_nodes.body[0]

with pytest.raises(ASTWithoutBody) as ast_without_body:
indentation_pattern(func_ast, codelines)

0 comments on commit 6d391cb

Please sign in to comment.