parent
47485a49f0
commit
483704508d
|
@ -287,6 +287,16 @@ class UrlParseTestCase(unittest.TestCase):
|
|||
self.assertEqual(p.port, None)
|
||||
self.assertEqual(p.geturl(), uri)
|
||||
|
||||
def test_caching(self):
|
||||
# Test case for bug #1313119
|
||||
uri = "http://example.com/doc/"
|
||||
unicode_uri = unicode(uri)
|
||||
|
||||
urlparse.urlparse(unicode_uri)
|
||||
p = urlparse.urlparse(uri)
|
||||
self.assertEqual(type(p.scheme), type(uri))
|
||||
self.assertEqual(type(p.hostname), type(uri))
|
||||
self.assertEqual(type(p.path), type(uri))
|
||||
|
||||
def test_main():
|
||||
test_support.run_unittest(UrlParseTestCase)
|
||||
|
|
|
@ -184,7 +184,7 @@ def urlsplit(url, scheme='', allow_fragments=True):
|
|||
Note that we don't break the components up in smaller bits
|
||||
(e.g. netloc is a single string) and we don't expand % escapes."""
|
||||
allow_fragments = bool(allow_fragments)
|
||||
key = url, scheme, allow_fragments
|
||||
key = url, scheme, allow_fragments, type(url), type(scheme)
|
||||
cached = _parse_cache.get(key, None)
|
||||
if cached:
|
||||
return cached
|
||||
|
|
Loading…
Reference in New Issue