File tree Expand file tree Collapse file tree 3 files changed +27
-9
lines changed Expand file tree Collapse file tree 3 files changed +27
-9
lines changed Original file line number Diff line number Diff line change 11import unittest
22from pathlib import Path
33from typing import List
4- from scripts .get_answered_questions import get_answered_questions , get_question_list
4+ from scripts .question_utils import get_answered_questions , get_question_list
55
66
77def open_test_case_file (n : int ) -> List [bytes ]:
Original file line number Diff line number Diff line change 66from pathlib import Path
77from typing import List
88from unittest import TestCase
9- from tests import syntax_checker
9+ from tests import syntax_lint
1010
1111
1212def open_test_case_file (n : int ) -> List [bytes ]:
@@ -25,18 +25,18 @@ def open_test_case_file(n: int) -> List[bytes]:
2525class TestSyntax (TestCase ):
2626
2727 def test_details_count_case1 (self ):
28- self .assertTrue (syntax_checker .count_details (test_case_1 ))
28+ self .assertTrue (syntax_lint .count_details (test_case_1 ))
2929
3030 def test_details_count_case2 (self ):
31- self .assertTrue (syntax_checker .count_details (test_case_2 ))
31+ self .assertTrue (syntax_lint .count_details (test_case_2 ))
3232
3333 def test_details_errors_1 (self ):
34- syntax_checker .check_details_tag (test_case_1 )
35- self .assertFalse (syntax_checker .errors )
34+ syntax_lint .check_details_tag (test_case_1 )
35+ self .assertFalse (syntax_lint .errors )
3636
3737 def test_details_errors_2 (self ):
38- syntax_checker .check_details_tag (test_case_2 )
39- self .assertFalse (syntax_checker .errors )
38+ syntax_lint .check_details_tag (test_case_2 )
39+ self .assertFalse (syntax_lint .errors )
4040 #
4141 # def test_details_error_exist_1(self):
4242 # syntax_checker.check_details_tag(test_case_3)
Original file line number Diff line number Diff line change 77that.
88
99Usage:
10- $ python tests/syntax_checker .py
10+ $ python tests/syntax_lint .py
1111
1212"""
1313
@@ -39,6 +39,24 @@ def count_details(file_list):
3939 return details_count == details_final_count
4040
4141
42+ def count_summary (file_list ):
43+ """
44+ Counts the total amount of <details> and </details>
45+
46+ Used for debugging purpose, not meant to be used in actual tests
47+ """
48+ details_final_count = 0
49+ details_count = 0
50+
51+ for line_number , line in enumerate (file_list ):
52+ if b'<summary>' in line :
53+ details_count += 1
54+ if b'</summary>' in line :
55+ details_final_count += 1
56+
57+ return details_count == details_final_count
58+
59+
4260def check_details_tag (file_list ):
4361 """
4462 Check whether the structure:
You can’t perform that action at this time.
0 commit comments