Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion furl/furl.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def add(self, path):
elif is_iterable_but_not_string(path): # List interface.
newsegments = path
else: # String interface.
newsegments = self._segments_from_path(path)
newsegments = self._segments_from_path(str(path))

# Preserve the opening '/' if one exists already (self.segments
# == ['']).
Expand Down
17 changes: 14 additions & 3 deletions tests/test_furl.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ def test_add(self):
assert p.add(['e', 'f', 'e e', '']) == p
assert p.isabsolute
assert str(p) == '/a/b/c/d/e/f/e%20e/'
assert p.add(12) == p
assert p.isabsolute
assert str(p) == '/a/b/c/d/e/f/e%20e/12'

f = furl.furl('http://sprop.ru')
assert not f.path.isabsolute
Expand Down Expand Up @@ -529,8 +532,11 @@ def test_itruediv(self):
p /= 'c d/'
assert str(p) == 'a/b/c%20d/'

p /= 12
assert str(p) == 'a/b/c%20d/12'

p /= furl.Path('e')
assert str(p) == 'a/b/c%20d/e'
assert str(p) == 'a/b/c%20d/12/e'

def test_truediv(self):
p = furl.Path()
Expand All @@ -539,10 +545,15 @@ def test_truediv(self):
assert p1 is not p
assert str(p1) == 'a'

p2 = p / 'a' / 'b'
p2 = p / 'a' / 12
assert p2 is not p
assert str(p2) == 'a/12'

p3 = p / 'a' / 12 / 'b'
assert p3 is not p
assert str(p3) == 'a/12/b'

assert str(p) == ''
assert str(p2) == 'a/b'

# Path objects should be joinable with other Path objects.
p3 = furl.Path('e')
Expand Down