dayrize-usecase/pipeline/beam_etl/tests/test_parse_raw_specs.py

11 lines
1.2 KiB
Python

from helpers import parse_raw_specs
def test_parse_raw_specs():
xml_str = """
<div class="styles__StyledCol-sc-ct8kx6-0 iKGdHS h-padding-h-tight" data-test="item-details-specifications"><h3 class="h-text-bs h-margin-b-tight">Specifications</h3><div><div><b>Suggested Age:</b> 6 Years and Up</div><hr/></div><div><div><b>CPSC Choking Hazard Warnings:</b> Choking_hazard_small_parts</div><hr/></div><div><b>TCIN</b>: <!-- -->81917300<hr/></div><div><b>UPC</b>: <!-- -->840391145528<hr/></div><div><b>Origin</b>: <!-- -->imported<hr/></div><div data-test="itemDetailsTabMarketplaceMessage"><p class="h-padding-t-x2">The above item details were provided by the Target Plus™ Partner. Target does not represent or warrant that this information is accurate or complete. On occasion, manufacturers may modify their items and update their labels.</p><p class="h-padding-t-x2">We recommend that you do not rely solely on the information presented. If you have a specific question about this item, you may consult the item\'s label, contact the manufacturer directly or call Target Guest Services at 1-800-591-3869.</p></div></div>
"""
expected = {"tcin": " 81917300", "origin": " imported"}
assert parse_raw_specs(xml_str) == expected