Skip to content

Commit

Permalink
Merge pull request #93 from Clear-Bible/rnd-26-add-additional-unit-te…
Browse files Browse the repository at this point in the history
…sts-for-error-element

Add tests with xfail for tracking presence of error elements
  • Loading branch information
jacobwegner authored Oct 16, 2024
2 parents b5b7ece + 1cc6fad commit e9ec642
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
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

0 comments on commit e9ec642

Please sign in to comment.