-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for :has(<relative operator>) #115
Conversation
d04a5be
to
8373e30
Compare
Co-authored-by: Eugenio Lacuesta <1731933+elacuesta@users.noreply.github.com>
8373e30
to
c4ef8c8
Compare
Codecov Report
@@ Coverage Diff @@
## master #115 +/- ##
==========================================
+ Coverage 95.39% 95.61% +0.22%
==========================================
Files 3 3
Lines 803 889 +86
Branches 139 152 +13
==========================================
+ Hits 766 850 +84
Misses 20 20
- Partials 17 19 +2
Continue to review full report at Codecov.
|
08ef93a
to
7bcc7e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Looks good! Do you think it would be possible to add some of the tests from #96? Edit: In particular, I'm interested in this test, which doesn't work under the current version (b64eacf): Python 3.8.2 (default, Apr 18 2020, 17:39:30)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cssselect import parse
>>> parse("div:has(div.foo)")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/eugenio/zyte/cssselect/cssselect/parser.py", line 475, in parse
return list(parse_selector_group(stream))
File "/home/eugenio/zyte/cssselect/cssselect/parser.py", line 488, in parse_selector_group
yield Selector(*parse_selector(stream))
File "/home/eugenio/zyte/cssselect/cssselect/parser.py", line 497, in parse_selector
result, pseudo_element = parse_simple_selector(stream)
File "/home/eugenio/zyte/cssselect/cssselect/parser.py", line 603, in parse_simple_selector
arguments = parse_relative_selector(stream)
File "/home/eugenio/zyte/cssselect/cssselect/parser.py", line 649, in parse_relative_selector
raise SelectorSyntaxError(
cssselect.parser.SelectorSyntaxError: Expected an argument, got <DELIM '.' at 11>
>>> |
4dc31e6
to
b64eacf
Compare
…_translation_change Revert xpath translation change to make it consistent
b313bd6
to
41a0f7f
Compare
52bbdd1
to
4a7de41
Compare
4a7de41
to
9d16efa
Compare
1f8ddd1
to
b4cbd4e
Compare
`In [58]: response.css("a:has(strong)")TypeError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/scrapy/http/response/text.py in css(self, query) /usr/local/lib/python3.7/dist-packages/parsel/selector.py in css(self, query) /usr/local/lib/python3.7/dist-packages/parsel/selector.py in _css2xpath(self, query) /usr/local/lib/python3.7/dist-packages/parsel/csstranslator.py in css_to_xpath(self, css, prefix) /usr/local/lib/python3.7/dist-packages/cssselect/xpath.py in css_to_xpath(self, css, prefix) /usr/local/lib/python3.7/dist-packages/cssselect/xpath.py in (.0) /usr/local/lib/python3.7/dist-packages/cssselect/xpath.py in selector_to_xpath(self, selector, prefix, translate_pseudo_elements) /usr/local/lib/python3.7/dist-packages/cssselect/xpath.py in xpath(self, parsed_selector) /usr/local/lib/python3.7/dist-packages/cssselect/xpath.py in xpath_relation(self, relation) /usr/local/lib/python3.7/dist-packages/cssselect/xpath.py in xpath_relation_descendant_combinator(self, left, right) TypeError: join() got an unexpected keyword argument 'closing_combiner' |
i have installed cssselect with |
Please, open a separate issue with a minimal reproducible example instead of commenting on an already closed pull request. You can link this pull request from your new issue for reference. |
todo: uncomment tests and watch them fail, then fix