From fffc60391a9c8e11c0df5cdac71098833ce27680 Mon Sep 17 00:00:00 2001 From: surister Date: Sat, 21 Dec 2019 23:18:34 +0100 Subject: [PATCH] error message improvement --- tests/syntax_checker.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/syntax_checker.py b/tests/syntax_checker.py index 17b6b74..31b7223 100644 --- a/tests/syntax_checker.py +++ b/tests/syntax_checker.py @@ -58,16 +58,17 @@ def check_details_tag(file_list): pass else: if b'
' in line and after_detail: + err_message = f'Missing closing detail tag round line {line_number - 1}' error = True if b'
' in line and not after_detail: - err_message = f'Missing opening detail tag at line {line_number}' + err_message = f'Missing opening detail tag round line {line_number - 1}' error = True if b'
' in line: after_detail = True if b'
' in line and after_detail: - err_message = f'Missing closing detail tag at line {line_number}' + after_detail = False if error: @@ -85,25 +86,25 @@ def check_summary_tag(file_list): """ - after_detail = False + after_summary = False error = False err_message = '' for line_number, line in enumerate(file_list): if b'' in line and b'' in line: pass else: - if b'' in line and after_detail: + if b'' in line and after_summary: + err_message = f'Missing closing summary tag around line {line_number}' error = True - if b'' in line and not after_detail: - err_message = f'Missing opening summary tag at line {line_number}' + if b'' in line and not after_summary: + err_message = f'Missing opening summary tag around line {line_number}' error = True if b'' in line: - after_detail = True + after_summary = True - if b'' in line and after_detail: - err_message = f'Missing closing summary tag at line {line_number}' - after_detail = False + if b'' in line and after_summary: + after_summary = False if error: raise Exception(err_message)