Skip to content

Commit

Permalink
test: instantiate with existing path/query, errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MicaelJarniac committed Feb 26, 2021
1 parent 2b12860 commit d14720e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_buildurl.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pytest import raises

from buildurl import BuildURL


Expand All @@ -16,6 +18,20 @@ def test_path():
assert url.get == "https://example.com/test/more"
assert str(url / "again") == "https://example.com/test/more/again"
assert url.get == "https://example.com/test/more"
url /= ["paths", "added"]
assert url.get == "https://example.com/test/more/paths/added"

with raises(AttributeError):
url /= 0
with raises(AttributeError):
url /= 0.1
with raises(AttributeError):
url /= True

assert url.get == "https://example.com/test/more/paths/added"

url = BuildURL("https://example.com/why")
assert url.get == "https://example.com/why"


def test_query():
Expand All @@ -30,6 +46,9 @@ def test_query():
)
assert url.get == "https://example.com?test=well&and=again"

url = BuildURL("https://example.com?testing=true")
assert url.get == "https://example.com?testing=true"


def test_copy():
url = BuildURL("https://example.com")
Expand Down

0 comments on commit d14720e

Please sign in to comment.