-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add exclude arg to file_patterns
- Loading branch information
Showing
5 changed files
with
77 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import shutil | ||
|
||
import pytest | ||
|
||
from . import file_patterns | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def copy_views(): | ||
"""Copy the views folder of the demo project to this folder""" | ||
shutil.copytree("demo/demo/views", "views") | ||
yield | ||
shutil.rmtree("views") | ||
|
||
|
||
def test_append_slash(): | ||
patterns = file_patterns("views", append_slash=True, exclude="") | ||
output = [(str(p.pattern), p.name) for p in patterns] | ||
assert output == [ | ||
("current-time/", "current_time"), | ||
("colors/add/", "colors_add"), | ||
("colors/", "colors"), | ||
("colors/<slug:slug>/", "colors_slug"), | ||
("", "home"), | ||
] | ||
|
||
|
||
def test_exclude(): | ||
patterns = file_patterns("views", append_slash=False, exclude="*-time.py") | ||
output = [(str(p.pattern), p.name) for p in patterns] | ||
assert output == [ | ||
("colors/add", "colors_add"), | ||
("colors", "colors"), | ||
("colors/<slug:slug>", "colors_slug"), | ||
("", "home"), | ||
] |