scrapy / parsel

Parsel lets you extract data from XML/HTML documents using XPath or CSS selectors
BSD 3-Clause "New" or "Revised" License
1.11k stars 137 forks source link

Create root node memory 210 v3 #269

Closed GeorgeA92 closed 1 year ago

GeorgeA92 commented 1 year ago

Aimed to fix https://github.com/scrapy/parsel/issues/210. With changes proposed in https://github.com/scrapy/parsel/pull/217#discussion_r906858630 (implemented separate argument name to pass bytes for selector) other parts(test etc.) - completely the same as on https://github.com/scrapy/parsel/pull/217

codecov[bot] commented 1 year ago

Codecov Report

Merging #269 (42cf4fc) into master (55248fa) will decrease coverage by 8.31%. The diff coverage is 77.96%.

:exclamation: Current head 42cf4fc differs from pull request most recent head f6a0650. Consider uploading reports for the commit f6a0650 to get more accurate results

@@             Coverage Diff             @@
##            master     #269      +/-   ##
===========================================
- Coverage   100.00%   91.69%   -8.31%     
===========================================
  Files            4        5       +1     
  Lines          138      349     +211     
  Branches        29       69      +40     
===========================================
+ Hits           138      320     +182     
- Misses           0       23      +23     
- Partials         0        6       +6     
Impacted Files Coverage Δ
parsel/csstranslator.py 86.07% <63.33%> (-13.93%) :arrow_down:
parsel/selector.py 90.90% <90.47%> (ø)
parsel/utils.py 100.00% <100.00%> (ø)
parsel/xpathfuncs.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Gallaecio commented 1 year ago

Mind that https://github.com/scrapy/parsel/pull/269#discussion_r1086787960 has not been completely addressed, the default value should be b"", not "".

GeorgeA92 commented 1 year ago

@Gallaecio Updated pull request. After updating condition in create_root_node and after updating body: Optional[bytes] = b"", from body: Optional[bytes] = None, in _get_root. - > All tests passed (at my local dev env)