-
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.
- Loading branch information
Showing
7 changed files
with
28 additions
and
27 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
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
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
14 changes: 7 additions & 7 deletions
14
tests/nlds/utils/test_construct_url.py → tests/nlds/utils/test_format_url.py
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
from nlds.utils.construct_url import construct_url | ||
from nlds.utils.format_url import format_url | ||
|
||
|
||
def test_no_parts(): | ||
assert construct_url([]) == "" | ||
assert format_url([]) == "" | ||
|
||
|
||
def test_single_part(): | ||
assert construct_url(["http://example.com"]) == "http://example.com" | ||
assert format_url(["http://example.com"]) == "http://example.com" | ||
|
||
|
||
def test_multiple_parts(): | ||
url_parts = ["http://example.com", "path", "to", "resource"] | ||
expected_url = "http://example.com/path/to/resource" | ||
assert construct_url(url_parts) == expected_url | ||
assert format_url(url_parts) == expected_url | ||
|
||
|
||
def test_with_query_params(): | ||
url_parts = ["http://example.com", "path", "to", "resource"] | ||
query_params = {"key1": "value1", "key2": "value2"} | ||
expected_url = "http://example.com/path/to/resource?key1=value1&key2=value2" | ||
assert construct_url(url_parts, query_params) == expected_url | ||
assert format_url(url_parts, query_params) == expected_url | ||
|
||
|
||
def test_empty_query_params(): | ||
url_parts = ["http://example.com", "path", "to", "resource"] | ||
query_params = {} | ||
expected_url = "http://example.com/path/to/resource" | ||
assert construct_url(url_parts, query_params) == expected_url | ||
assert format_url(url_parts, query_params) == expected_url | ||
|
||
|
||
def test_complex_query_params(): | ||
url_parts = ["http://example.com", "search"] | ||
query_params = {"q": "test search", "page": "1", "sort": "asc"} | ||
expected_url = "http://example.com/search?q=test+search&page=1&sort=asc" | ||
assert construct_url(url_parts, query_params) == expected_url | ||
assert format_url(url_parts, query_params) == expected_url |