scrapy / itemloaders

Library to populate items using XPath and CSS with a convenient API
BSD 3-Clause "New" or "Revised" License
45 stars 16 forks source link

add judgement to _add_value #43

Closed scxdhr1998 closed 3 years ago

scxdhr1998 commented 3 years ago

hello! I found that if add a scrapy item to itemloader, += will lose its value. so I added the previous version of the method back, use append to add an item.

codecov[bot] commented 3 years ago

Codecov Report

Merging #43 (5586efd) into master (c64cd99) will decrease coverage by 0.38%. The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #43      +/-   ##
==========================================
- Coverage   99.60%   99.21%   -0.39%     
==========================================
  Files           4        4              
  Lines         254      256       +2     
==========================================
+ Hits          253      254       +1     
- Misses          1        2       +1     
Impacted Files Coverage Δ
itemloaders/__init__.py 98.72% <66.66%> (-0.63%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c64cd99...62eaa27. Read the comment docs.

Gallaecio commented 3 years ago

Could you please include a test to cover the scenario that this patch is meant to fix?

scxdhr1998 commented 3 years ago

Could you please include a test to cover the scenario that this patch is meant to fix?

ok, i will try

scxdhr1998 commented 3 years ago

Could you please include a test to cover the scenario that this patch is meant to fix?

Sorry I cant reproduce the bug. I guess my item is not verified by arg_to_iter for some reason, so it lost value when self._values[field_name] += arg_to_iter(processed_value)