2022-01-16 08:24:05 +08:00
|
|
|
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
|