Skip to content

Commit 1621e19

Browse files
Add initial testing module for api.py
1 parent 5473bfa commit 1621e19

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_api.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""Tests the isort API module"""
2+
import pytest
3+
4+
from isort import api, exceptions
5+
6+
7+
def test_sort_file_invalid_syntax(tmpdir) -> None:
8+
"""Test to ensure file encoding is respected"""
9+
tmp_file = tmpdir.join(f"test_bad_syntax.py")
10+
tmp_file.write_text("""print('mismathing quotes")""", "utf8")
11+
with pytest.warns(UserWarning):
12+
api.sort_file(tmp_file, atomic=True)

0 commit comments

Comments
 (0)