forked from plotly/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix path_template variable parsing containing dots
see plotly#2437
- Loading branch information
Showing
2 changed files
with
32 additions
and
17 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 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,21 @@ | ||
from dash._pages import _parse_path_variables | ||
|
||
|
||
def test_path_template_general(): | ||
path_template = "some/<var>/static" | ||
assert _parse_path_variables("some/value/static", path_template) == {'var': 'value'} | ||
|
||
|
||
def test_path_template(): | ||
path_template = "<foo>/<bar>" | ||
assert _parse_path_variables("one/two", path_template) == {'foo': 'one', 'bar': 'two'} | ||
|
||
|
||
def test_path_template_dots(): | ||
path_template = "<foo>.<bar>" | ||
assert _parse_path_variables("one.two", path_template) == {'foo': 'one', 'bar': 'two'} | ||
|
||
|
||
def test_path_template_none(): | ||
path_template = "novars" | ||
assert _parse_path_variables("one/two", path_template) is None |