Commits

Marc Abramowitz committed 4191f40

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

Comments (0)

Files changed (2)

test_urllib_dot_parse.py

     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)

test_urllib_parse.py

     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)