Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Unified Diff: Lib/test/test_urlparse.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_urllib.py ('k') | Lib/test/test_warnings.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_urlparse.py Tue Jul 26 09:37:46 2011 +0300
+++ b/Lib/test/test_urlparse.py Mon Jul 25 09:47:18 2011 -0400
@@ -93,11 +93,8 @@
def test_qsl(self):
for orig, expect in parse_qsl_test_cases:
result = urllib.parse.parse_qsl(orig, keep_blank_values=True)
- self.assertEqual(result, expect, "Error parsing %r" % orig)
- expect_without_blanks = [v for v in expect if len(v[1])]
- result = urllib.parse.parse_qsl(orig, keep_blank_values=False)
- self.assertEqual(result, expect_without_blanks,
- "Error parsing %r" % orig)
+ self.assertEqual(result, expect, "Error parsing %s" % repr(orig))
+
def test_roundtrips(self):
str_cases = [
@@ -368,9 +365,6 @@
self.checkJoin(SIMPLE_BASE, 'http:?y','http://a/b/c/d?y')
self.checkJoin(SIMPLE_BASE, 'http:g?y','http://a/b/c/g?y')
self.checkJoin(SIMPLE_BASE, 'http:g?y/./x','http://a/b/c/g?y/./x')
- self.checkJoin('http:///', '..','http:///')
- self.checkJoin('', 'http://a/b/c/g?y/./x','http://a/b/c/g?y/./x')
- self.checkJoin('', 'http://a/./g', 'http://a/./g')
def test_RFC2732(self):
str_cases = [
@@ -725,74 +719,6 @@
errors="ignore")
self.assertEqual(result, [('key', '\u0141-')])
- def test_splitnport(self):
- # Normal cases are exercised by other tests; ensure that we also
- # catch cases with no port specified. (testcase ensuring coverage)
- result = urllib.parse.splitnport('parrot:88')
- self.assertEqual(result, ('parrot', 88))
- result = urllib.parse.splitnport('parrot')
- self.assertEqual(result, ('parrot', -1))
- result = urllib.parse.splitnport('parrot', 55)
- self.assertEqual(result, ('parrot', 55))
- result = urllib.parse.splitnport('parrot:')
- self.assertEqual(result, ('parrot', None))
-
- def test_splitquery(self):
- # Normal cases are exercised by other tests; ensure that we also
- # catch cases with no port specified (testcase ensuring coverage)
- result = urllib.parse.splitquery('http://python.org/fake?foo=bar')
- self.assertEqual(result, ('http://python.org/fake', 'foo=bar'))
- result = urllib.parse.splitquery('http://python.org/fake?foo=bar?')
- self.assertEqual(result, ('http://python.org/fake?foo=bar', ''))
- result = urllib.parse.splitquery('http://python.org/fake')
- self.assertEqual(result, ('http://python.org/fake', None))
-
- def test_splitvalue(self):
- # Normal cases are exercised by other tests; test pathological cases
- # with no key/value pairs. (testcase ensuring coverage)
- result = urllib.parse.splitvalue('foo=bar')
- self.assertEqual(result, ('foo', 'bar'))
- result = urllib.parse.splitvalue('foo=')
- self.assertEqual(result, ('foo', ''))
- result = urllib.parse.splitvalue('foobar')
- self.assertEqual(result, ('foobar', None))
-
- def test_to_bytes(self):
- result = urllib.parse.to_bytes('http://www.python.org')
- self.assertEqual(result, 'http://www.python.org')
- self.assertRaises(UnicodeError, urllib.parse.to_bytes,
- 'http://www.python.org/medi\u00e6val')
-
- def test_urlencode_sequences(self):
- # Other tests incidentally urlencode things; test non-covered cases:
- # Sequence and object values.
- result = urllib.parse.urlencode({'a': [1, 2], 'b': (3, 4, 5)}, True)
- self.assertEqual(result, 'a=1&a=2&b=3&b=4&b=5')
-
- class Trivial:
- def __str__(self):
- return 'trivial'
-
- result = urllib.parse.urlencode({'a': Trivial()}, True)
- self.assertEqual(result, 'a=trivial')
-
- def test_quote_from_bytes(self):
- self.assertRaises(TypeError, urllib.parse.quote_from_bytes, 'foo')
- result = urllib.parse.quote_from_bytes(b'archaeological arcana')
- self.assertEqual(result, 'archaeological%20arcana')
- result = urllib.parse.quote_from_bytes(b'')
- self.assertEqual(result, '')
-
- def test_unquote_to_bytes(self):
- result = urllib.parse.unquote_to_bytes('abc%20def')
- self.assertEqual(result, b'abc def')
- result = urllib.parse.unquote_to_bytes('')
- self.assertEqual(result, b'')
-
- def test_quote_errors(self):
- self.assertRaises(TypeError, urllib.parse.quote, b'foo',
- encoding='utf-8')
- self.assertRaises(TypeError, urllib.parse.quote, b'foo', errors='strict')
def test_main():
« no previous file with comments | « Lib/test/test_urllib.py ('k') | Lib/test/test_warnings.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+