Skip to content

Commit

Permalink
add unit test for is_exclude_file
Browse files Browse the repository at this point in the history
  • Loading branch information
sh4869 committed Jan 16, 2019
1 parent 0eb43b5 commit 1ef0fb1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test_autoflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,23 @@ def test_is_python_file(self):
self.assertFalse(autoflake.is_python_file(os.devnull))
self.assertFalse(autoflake.is_python_file('/bin/bash'))

def test_is_exclude_file(self):
self.assertTrue(autoflake.is_exclude_file(
"1.py", ["test*", "1*"]))

self.assertFalse(autoflake.is_exclude_file(
"2.py", ["test*", "1*"]))

# folder glob
self.assertTrue(autoflake.is_exclude_file(
"test/test.py", ["test/**.py"]))

self.assertTrue(autoflake.is_exclude_file(
"test/auto_test.py", ["test/*_test.py"]))

self.assertFalse(autoflake.is_exclude_file(
"test/auto_auto.py", ["test/*_test.py"]))

def test_match_file(self):
with temporary_file('', suffix='.py', prefix='.') as filename:
self.assertFalse(autoflake.match_file(filename, exclude=[]),
Expand Down

0 comments on commit 1ef0fb1

Please sign in to comment.