Gael Pasgrimaud avatar Gael Pasgrimaud committed 46e7768

fix test for py3

Comments (0)

Files changed (3)

 PyQuery now use `cssselect <>`_. See issue
+Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring``


                     elements = fromstring(context, self.parser)
                 except Exception:
+                    raise
                     raise ValueError(repr(context))
             elif isinstance(context, self.__class__):
                 # copy
             # select nodes
             if elements and selector is not no_default:
                 xpath = selector_to_xpath(selector)
-                try:
-                    results = [tag.xpath(xpath, namespaces=namespaces) \
+                results = [tag.xpath(xpath, namespaces=namespaces) \
                                                     for tag in elements]
-                except Exception, e:
-                    raise e.__class__(xpath)
                 # Flatten the results
                 elements = []
                 for r in results:
     def test_selector(self):
         expected = 'What'
-        d = pq(self.xml, parser='xml')
+        d = pq(b(self.xml), parser='xml')
         val = d('bar|blah', namespaces={'bar': ''}).text()
         self.assertEqual(repr(val), repr(expected))
     def test_selector_with_xml(self):
         expected = 'What'
-        d = pq('bar|blah', self.xml, parser='xml', namespaces={'bar': ''})
+        d = pq('bar|blah', b(self.xml), parser='xml', namespaces={'bar': ''})
         val = d.text()
         self.assertEqual(repr(val), repr(expected))
     def test_selector_html(self):
         expected = 'What'
-        d = pq('blah', self.xml, parser='html')
+        d = pq('blah', self.xml.split('?>', 1)[1], parser='html')
         val = d.text()
         self.assertEqual(repr(val), repr(expected))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.