Skip to content

Commit 5639f3d

Browse files
committed
✔ Add a tests that checks if plain text files with BOM are read correctly
1 parent 9fc8937 commit 5639f3d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/dinglehopper/tests/test_ocr_files.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,15 @@ def test_plain(tmp_path):
182182
result = plain_text("ocr.txt")
183183
expected = "First, a line.\nAnd a second line."
184184
assert result == expected
185+
186+
187+
def test_plain_BOM(tmp_path):
188+
"""Test that plain text files with BOM are read correctly."""
189+
BOM = "\ufeff"
190+
with working_directory(tmp_path):
191+
with open("ocr.txt", "w") as ocrf:
192+
ocrf.write(BOM + "First, a line.\nAnd a second line.\n")
193+
194+
result = plain_text("ocr.txt")
195+
expected = "First, a line.\nAnd a second line."
196+
assert result == expected

0 commit comments

Comments
 (0)