Rename files

This commit is contained in:
surister 2020-01-09 12:12:06 +01:00
parent ade931c4cc
commit 4cb19b02b5
3 changed files with 27 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import unittest
from pathlib import Path
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]:

View File

@ -6,7 +6,7 @@ Yes, we do write tests for our tests.
from pathlib import Path
from typing import List
from unittest import TestCase
from tests import syntax_checker
from tests import syntax_lint
def open_test_case_file(n: int) -> List[bytes]:
@ -25,18 +25,18 @@ test_case_3 = open_test_case_file(3)
class TestSyntax(TestCase):
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):
self.assertTrue(syntax_checker.count_details(test_case_2))
self.assertTrue(syntax_lint.count_details(test_case_2))
def test_details_errors_1(self):
syntax_checker.check_details_tag(test_case_1)
self.assertFalse(syntax_checker.errors)
syntax_lint.check_details_tag(test_case_1)
self.assertFalse(syntax_lint.errors)
def test_details_errors_2(self):
syntax_checker.check_details_tag(test_case_2)
self.assertFalse(syntax_checker.errors)
syntax_lint.check_details_tag(test_case_2)
self.assertFalse(syntax_lint.errors)
#
# def test_details_error_exist_1(self):
# syntax_checker.check_details_tag(test_case_3)

View File

@ -7,7 +7,7 @@ same, due to readability and functionality it was decided to be split like
that.
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
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):
"""
Check whether the structure: