Rename files
This commit is contained in:
parent
ade931c4cc
commit
4cb19b02b5
@ -1,7 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
from scripts.get_answered_questions import get_answered_questions, get_question_list
|
from scripts.question_utils import get_answered_questions, get_question_list
|
||||||
|
|
||||||
|
|
||||||
def open_test_case_file(n: int) -> List[bytes]:
|
def open_test_case_file(n: int) -> List[bytes]:
|
||||||
|
@ -6,7 +6,7 @@ Yes, we do write tests for our tests.
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from tests import syntax_checker
|
from tests import syntax_lint
|
||||||
|
|
||||||
|
|
||||||
def open_test_case_file(n: int) -> List[bytes]:
|
def open_test_case_file(n: int) -> List[bytes]:
|
||||||
@ -25,18 +25,18 @@ test_case_3 = open_test_case_file(3)
|
|||||||
class TestSyntax(TestCase):
|
class TestSyntax(TestCase):
|
||||||
|
|
||||||
def test_details_count_case1(self):
|
def test_details_count_case1(self):
|
||||||
self.assertTrue(syntax_checker.count_details(test_case_1))
|
self.assertTrue(syntax_lint.count_details(test_case_1))
|
||||||
|
|
||||||
def test_details_count_case2(self):
|
def test_details_count_case2(self):
|
||||||
self.assertTrue(syntax_checker.count_details(test_case_2))
|
self.assertTrue(syntax_lint.count_details(test_case_2))
|
||||||
|
|
||||||
def test_details_errors_1(self):
|
def test_details_errors_1(self):
|
||||||
syntax_checker.check_details_tag(test_case_1)
|
syntax_lint.check_details_tag(test_case_1)
|
||||||
self.assertFalse(syntax_checker.errors)
|
self.assertFalse(syntax_lint.errors)
|
||||||
|
|
||||||
def test_details_errors_2(self):
|
def test_details_errors_2(self):
|
||||||
syntax_checker.check_details_tag(test_case_2)
|
syntax_lint.check_details_tag(test_case_2)
|
||||||
self.assertFalse(syntax_checker.errors)
|
self.assertFalse(syntax_lint.errors)
|
||||||
#
|
#
|
||||||
# def test_details_error_exist_1(self):
|
# def test_details_error_exist_1(self):
|
||||||
# syntax_checker.check_details_tag(test_case_3)
|
# syntax_checker.check_details_tag(test_case_3)
|
||||||
|
@ -7,7 +7,7 @@ same, due to readability and functionality it was decided to be split like
|
|||||||
that.
|
that.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
$ python tests/syntax_checker.py
|
$ python tests/syntax_lint.py
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -39,6 +39,24 @@ def count_details(file_list):
|
|||||||
return details_count == details_final_count
|
return details_count == details_final_count
|
||||||
|
|
||||||
|
|
||||||
|
def count_summary(file_list):
|
||||||
|
"""
|
||||||
|
Counts the total amount of <details> and </details>
|
||||||
|
|
||||||
|
Used for debugging purpose, not meant to be used in actual tests
|
||||||
|
"""
|
||||||
|
details_final_count = 0
|
||||||
|
details_count = 0
|
||||||
|
|
||||||
|
for line_number, line in enumerate(file_list):
|
||||||
|
if b'<summary>' in line:
|
||||||
|
details_count += 1
|
||||||
|
if b'</summary>' in line:
|
||||||
|
details_final_count += 1
|
||||||
|
|
||||||
|
return details_count == details_final_count
|
||||||
|
|
||||||
|
|
||||||
def check_details_tag(file_list):
|
def check_details_tag(file_list):
|
||||||
"""
|
"""
|
||||||
Check whether the structure:
|
Check whether the structure:
|
Loading…
Reference in New Issue
Block a user