Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests with xfail for tracking presence of error elements #93

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
tsv_path = "../Nestle1904/tsv/macula-greek-Nestle1904.tsv"
__tsv_files__ = [tsv_path]

ERROR_EXPRESSION = "//*[starts-with(local-name(), 'error') or starts-with(local-name(), 'error_')]"

with open(tsv_path, encoding='utf-8') as file:
reader = csv.DictReader(file, delimiter="\t")
for row in reader:
Expand Down
12 changes: 11 additions & 1 deletion test/test_nestle1904_lowfat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import codecs
import re
from lxml import etree
from test import __lowfat_files__, run_xpath_for_file
from test import ERROR_EXPRESSION, __lowfat_files__, run_xpath_for_file


@pytest.mark.parametrize("lowfat_file", __lowfat_files__)
Expand Down Expand Up @@ -73,6 +73,16 @@ def test_number_of_words():
total_count += len(count)
assert total_count == 137779


# Expected failure.
# See: https://github.com/Clear-Bible/macula-greek/issues/92#issuecomment-2407973591
@pytest.mark.xfail
@pytest.mark.parametrize("lowfat_file", __lowfat_files__)
def test_no_errors(lowfat_file):
count = len(run_xpath_for_file(ERROR_EXPRESSION, lowfat_file))
assert count == 0


@pytest.mark.parametrize("lowfat_file", __lowfat_files__)
def test_referent_id_validity(lowfat_file):
valid_ids = []
Expand Down
12 changes: 11 additions & 1 deletion test/test_sblgnt_lowfat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import codecs
import re
from lxml import etree
from test import __sblgnt_lowfat_files__, run_xpath_for_file
from test import ERROR_EXPRESSION, __sblgnt_lowfat_files__, run_xpath_for_file


@pytest.mark.parametrize("lowfat_file", __sblgnt_lowfat_files__)
Expand Down Expand Up @@ -76,6 +76,16 @@ def test_number_of_words():
total_count += len(count)
assert total_count == 137741


# Expected failure.
# See: https://github.com/Clear-Bible/macula-greek/issues/92#issuecomment-2407973591
@pytest.mark.xfail
@pytest.mark.parametrize("lowfat_file", __sblgnt_lowfat_files__)
def test_no_errors(lowfat_file):
count = len(run_xpath_for_file(ERROR_EXPRESSION, lowfat_file))
assert count == 0


# TODO: Discuss with team and restore this test
# @pytest.mark.parametrize("lowfat_file", __sblgnt_lowfat_files__)
# def test_referent_id_validity(lowfat_file):
Expand Down
Loading