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 test for default attributes in USFM #93

Merged
merged 1 commit into from
Jan 8, 2024
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
1 change: 0 additions & 1 deletion machine/corpora/usfm_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def set_attributes(
if default_attribute_name is not None:
self.attributes = [UsfmAttribute(default_attribute_name, default_value)]
self._default_attribute_name = default_attribute_name
self._is_default_attribute = True
return text
return None

Expand Down
2 changes: 1 addition & 1 deletion tests/corpora/test_usfm_file_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_get_rows_include_markers() -> None:
assert rows[5].text == "Chapter \\add two\\add*, verse \\f + \\fr 2:1: \\ft This is a footnote.\\f*one."

assert verse_ref(rows[6]).exact_equals(VerseRef.from_string("MAT 2:2", corpus.versification))
assert rows[6].text == "Chapter two, verse \\fm ∆\\fm*two. Chapter two, verse three."
assert rows[6].text == "Chapter two, verse \\fm ∆\\fm*two. Chapter two, verse \\w three|lemma\\w*."
assert rows[6].is_in_range
assert rows[6].is_range_start

Expand Down
2 changes: 1 addition & 1 deletion tests/corpora/test_usfm_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def test_tokenize() -> None:
usfm = _read_usfm()
usfm_tokenizer = UsfmTokenizer()
tokens = usfm_tokenizer.tokenize(usfm)
assert len(tokens) == 131
assert len(tokens) == 136

assert tokens[0].type is UsfmTokenType.BOOK
assert tokens[0].marker == "id"
Expand Down
2 changes: 1 addition & 1 deletion tests/testutils/data/usfm/Tes/41MATTes.SFM
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
\p
\v 1 Chapter \add two\add*, verse \f + \fr 2:1: \ft This is a footnote.\f*one.
\v 2-3 Chapter two, verse \fm ∆\fm*two.
\v 3-4a Chapter two, verse three.
\v 3-4a Chapter two, verse \w three|lemma\w*.
\v 4b Chapter two, verse four.
\p
\v 6 Chapter two, verse \w six|strong="12345" \w*.
Expand Down