Skip to content

Commit 1ef0fb1

Browse files
committed
add unit test for is_exclude_file
1 parent 0eb43b5 commit 1ef0fb1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test_autoflake.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,23 @@ def test_is_python_file(self):
11911191
self.assertFalse(autoflake.is_python_file(os.devnull))
11921192
self.assertFalse(autoflake.is_python_file('/bin/bash'))
11931193

1194+
def test_is_exclude_file(self):
1195+
self.assertTrue(autoflake.is_exclude_file(
1196+
"1.py", ["test*", "1*"]))
1197+
1198+
self.assertFalse(autoflake.is_exclude_file(
1199+
"2.py", ["test*", "1*"]))
1200+
1201+
# folder glob
1202+
self.assertTrue(autoflake.is_exclude_file(
1203+
"test/test.py", ["test/**.py"]))
1204+
1205+
self.assertTrue(autoflake.is_exclude_file(
1206+
"test/auto_test.py", ["test/*_test.py"]))
1207+
1208+
self.assertFalse(autoflake.is_exclude_file(
1209+
"test/auto_auto.py", ["test/*_test.py"]))
1210+
11941211
def test_match_file(self):
11951212
with temporary_file('', suffix='.py', prefix='.') as filename:
11961213
self.assertFalse(autoflake.match_file(filename, exclude=[]),

0 commit comments

Comments
 (0)