Commits

Gael Pasgrimaud committed 46e7768

fix test for py3

Comments (0)

Files changed (3)

 PyQuery now use `cssselect <http://pypi.python.org/pypi/cssselect>`_. See issue
 43.
 
+Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring``
+
 1.1.1
 -----
 

pyquery/pyquery.py

                 try:
                     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': 'http://example.com/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': 'http://example.com/bar'})
+        d = pq('bar|blah', b(self.xml), parser='xml', namespaces={'bar': 'http://example.com/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))