Skip to content
Merged
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
6 changes: 5 additions & 1 deletion tests/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest
from w3lib.url import (safe_url_string, safe_download_url,
url_query_parameter, add_or_replace_parameter, url_query_cleaner,
file_uri_to_path, path_to_file_uri, any_to_uri)
file_uri_to_path, path_to_file_uri, any_to_uri, urljoin_rfc)

class UrlTests(unittest.TestCase):

Expand Down Expand Up @@ -315,6 +315,10 @@ def test_any_to_uri(self):
self.assertEqual(any_to_uri("http://www.example.com/some/path.txt"),
"http://www.example.com/some/path.txt")

def test_urljoin_rfc_deprecated(self):
jurl = urljoin_rfc("http://www.example.com/", "/test")
self.assertEqual(jurl, b"http://www.example.com/test")


if __name__ == "__main__":
unittest.main()
Expand Down
4 changes: 2 additions & 2 deletions w3lib/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def urljoin_rfc(base, ref, encoding='utf-8'):
warnings.warn("w3lib.url.urljoin_rfc is deprecated, use urlparse.urljoin instead",
DeprecationWarning)

str_base = unicode_to_str(base, encoding)
str_ref = unicode_to_str(ref, encoding)
str_base = to_bytes(base, encoding)
str_ref = to_bytes(ref, encoding)
return urljoin(str_base, str_ref)

_reserved = b';/?:@&=+$|,#' # RFC 3986 (Generic Syntax)
Expand Down