Skip to content

Commit

Permalink
Doing the test by opening the file in binary mode. RE:natcap#1460
Browse files Browse the repository at this point in the history
  • Loading branch information
phargogh committed Dec 8, 2023
1 parent 4dbe7f5 commit 0bc66be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_hra.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ def test_criteria_table_parsing_with_bom(self):
))

# Sanity check: make sure the file has the expected BOM
bom_char = "\uFEFF" # byte-order marker in 16-bit hex value
with open(criteria_table_path) as criteria_table:
assert criteria_table.read().startswith(bom_char)
# Gotta use binary mode so that python doesn't silently strip the BOM
with open(criteria_table_path, 'rb') as criteria_table:
self.assertTrue(criteria_table.read().startswith(b"\xef\xbb\xbf"))

target_composite_csv_path = os.path.join(self.workspace_dir,
'composite.csv')
Expand Down

0 comments on commit 0bc66be

Please sign in to comment.