Port: Handle invalid book id tags more robustly#292
Conversation
…ine.py Agent-Logs-Url: https://github.com/sillsdev/machine.py/sessions/9308171f-88dc-496e-b821-a521af004991 Co-authored-by: ddaspit <3261883+ddaspit@users.noreply.github.com>
Agent-Logs-Url: https://github.com/sillsdev/machine.py/sessions/9308171f-88dc-496e-b821-a521af004991 Co-authored-by: ddaspit <3261883+ddaspit@users.noreply.github.com>
|
|
||
|
|
||
| def test_get_rows_book_code_invalid() -> None: | ||
| import pytest |
There was a problem hiding this comment.
@copilot Move pytest import to the top of the file.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #292 +/- ##
=======================================
Coverage 91.49% 91.50%
=======================================
Files 355 355
Lines 22835 22861 +26
=======================================
+ Hits 20894 20920 +26
Misses 1941 1941 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Agent-Logs-Url: https://github.com/sillsdev/machine.py/sessions/65c86bdf-e2f9-4998-b0ba-5b62409675cd Co-authored-by: ddaspit <3261883+ddaspit@users.noreply.github.com>
ddaspit
left a comment
There was a problem hiding this comment.
@ddaspit reviewed 6 files and all commit messages, made 2 comments, and resolved 1 discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on copilot[bot]).
tests/corpora/test_usfm_memory_text.py line 470 at r2 (raw file):
def test_get_rows_book_code_different_to_filename() -> None: with pytest.raises(Exception):
@copilot[bot] Check for the specific error that is thrown.
Agent-Logs-Url: https://github.com/sillsdev/machine.py/sessions/7f649636-4646-4f0b-ab79-e05fa6d8acda Co-authored-by: ddaspit <3261883+ddaspit@users.noreply.github.com>
ddaspit
left a comment
There was a problem hiding this comment.
@ddaspit reviewed 1 file and all commit messages, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on copilot[bot]).
usfm_parser.py: Truncate book code to 3 characters when longer than 3usfm_text_base.py: Instart_book, add early return ifverse_ref.bookis already set and doesn't match the new code (handle multiple\idmarkers)usfm_file_text_corpus.py: In_get_id, add truncation to 3 chars if id has no space or space after position 3; always uppercase the result03LEVTes.SFMand131CHTes.SFMto use full book names (without " - Test")test_usfm_memory_text.pyfor invalid/truncated/multiple/no-space book code scenariospytestimport to the top oftest_usfm_memory_text.pyRuntimeError(not genericException) in the three error-raising test casesThis change is