pre-commit-hooks/tests/check_byte_order_marker_tes...

16 lines
405 B
Python
Raw Permalink Normal View History

from __future__ import annotations
2016-03-19 01:59:31 +08:00
from pre_commit_hooks import check_byte_order_marker
def test_failure(tmpdir):
f = tmpdir.join('f.txt')
f.write_text('ohai', encoding='utf-8-sig')
2020-05-21 00:07:45 +08:00
assert check_byte_order_marker.main((str(f),)) == 1
2016-03-19 01:59:31 +08:00
def test_success(tmpdir):
f = tmpdir.join('f.txt')
f.write_text('ohai', encoding='utf-8')
2020-05-21 00:07:45 +08:00
assert check_byte_order_marker.main((str(f),)) == 0