Skip to content

Commit

Permalink
Correctly represent scheme-relative URI. Fixes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
amcgregor committed Nov 5, 2018
1 parent 7d85ef9 commit 1d8220f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/test_uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def test_empty_protocol_assignment(self, empty):
assert empty.scheme == 'http'

empty.scheme = None
assert str(empty) == "example.com/over/there"
assert str(empty) == "//example.com/over/there"

def test_bad_assignment(self, empty):
with pytest.raises(AttributeError):
Expand Down
3 changes: 3 additions & 0 deletions uri/part/scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def render(self, obj, value):
if obj._scheme and obj.scheme.slashed:
result = result + '//'

if not obj._scheme and obj.authority:
result = '//'

return result

def __get__(self, obj, cls=None):
Expand Down
3 changes: 0 additions & 3 deletions uri/part/uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ def __get__(self, obj, cls=None):
value = getattr(obj, part)
part = getattr(cls, part)

if value is None:
continue

components.append(part.render(obj, value))

return "".join(components)
Expand Down

0 comments on commit 1d8220f

Please sign in to comment.