Skip to content

Commit

Permalink
modified: contextualSpellCheck/contextualSpellCheck.py
Browse files Browse the repository at this point in the history
	- Set `encoding="utf8"` in :method:`ContextualSpellCheck.__init__` when `debug=True` to resolve failing unit test, :callable:`test_vocab_file`.

modified:   contextualSpellCheck/tests/test_contextualSpellCheck.py
	- Set `encoding="utf8"` in test :callable:`test_vocab_file` to match encoding in :method:`ContextualSpellCheck.__init__` when `debug=True` allowing test to pass.
  • Loading branch information
it176131 committed Dec 8, 2024
1 parent b67d889 commit 6f8bde1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contextualSpellCheck/contextualSpellCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(
debug_file_path = os.path.join(
current_path, "tests", "debugFile.txt"
)
with open(debug_file_path, "w+") as new_file:
with open(debug_file_path, "w+", encoding="utf8") as new_file:
new_file.write("\n".join(words))
print("Final vocab at " + debug_file_path)

Expand Down
4 changes: 2 additions & 2 deletions contextualSpellCheck/tests/test_contextualSpellCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ def test_vocab_file():
ContextualSpellCheck(
nlp, "contextualSpellCheck", vocab_path=testVocab, debug=True
)
with open(orgDebugFilePath) as f1:
with open(debugPathFile) as f2:
with open(orgDebugFilePath, encoding="utf8") as f1:
with open(debugPathFile, encoding="utf8") as f2:
assert f1.read() == f2.read()


Expand Down

0 comments on commit 6f8bde1

Please sign in to comment.