diff --git a/tests/test_code_process.py b/tests/test_code_process.py index 9a6c28b..92f7bb0 100644 --- a/tests/test_code_process.py +++ b/tests/test_code_process.py @@ -8,7 +8,8 @@ func_codelines, process_code, indentation_pattern, - ASTWithoutBody + ASTWithoutBody, + InvalidIndentation ) from markarth.convert.collect.mod_collect import collect_func_defs @@ -61,4 +62,17 @@ def test_indentation_pattern_ast_without_body(): func_ast = ast_nodes.body[0] with pytest.raises(ASTWithoutBody) as ast_without_body: - indentation_pattern(func_ast, codelines) \ No newline at end of file + indentation_pattern(func_ast, codelines) + + +def test_indentation_pattern_invalid_indentation_level(): + code = ''' +def f(): + this_code_is_nah = None +''' + + ast_nodes, codelines = process_code(code) + func_ast = ast_nodes.body[0] + + with pytest.raises(InvalidIndentation) as ast_without_body: + indentation_pattern(func_ast, codelines, indent_level = 2) \ No newline at end of file