1. Marc Abramowitz
  2. six_msabramo_urllib_parse

Commits

Marc Abramowitz  committed 4191f40

Fix test failures on Python 2.5 due to Python 2.5 not having
urlparse.parse_qs[l]

  • Participants
  • Parent commits 0d35042
  • Branches default

Comments (0)

Files changed (2)

File test_urllib_dot_parse.py

View file
  • Ignore whitespace
     if PY3:
         from urllib.parse import parse_qs
     else:
-        from urlparse import parse_qs
+        try:
+            from urlparse import parse_qs
+        except ImportError:
+            # This name isn't present in Python 2.5
+            return
 
     arg = 'a=1&b=2'
     assert urllib.parse.parse_qs(arg) == parse_qs(arg)
     if PY3:
         from urllib.parse import parse_qsl
     else:
-        from urlparse import parse_qsl
+        try:
+            from urlparse import parse_qsl
+        except ImportError:
+            # This name isn't present in Python 2.5
+            return
 
     arg = 'a=1&b=2'
     assert urllib.parse.parse_qsl(arg) == parse_qsl(arg)

File test_urllib_parse.py

View file
  • Ignore whitespace
     if PY3:
         from urllib.parse import parse_qs
     else:
-        from urlparse import parse_qs
+        try:
+            from urlparse import parse_qs
+        except ImportError:
+            # This name isn't present in Python 2.5
+            return
 
     arg = 'a=1&b=2'
     assert urllib_parse.parse_qs(arg) == parse_qs(arg)
     if PY3:
         from urllib.parse import parse_qsl
     else:
-        from urlparse import parse_qsl
+        try:
+            from urlparse import parse_qsl
+        except ImportError:
+            # This name isn't present in Python 2.5
+            return
 
     arg = 'a=1&b=2'
     assert urllib_parse.parse_qsl(arg) == parse_qsl(arg)