Minor fixes in parsing utils.
This commit is contained in:
parent
3b79ba06d8
commit
cb553b5f7e
2 changed files with 9 additions and 0 deletions
|
|
@ -498,6 +498,14 @@ class ParsingFlow:
|
||||||
for instruction in self._instructions:
|
for instruction in self._instructions:
|
||||||
instruction.scrape(soup).validate()
|
instruction.scrape(soup).validate()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def field_values(self) -> Dict:
|
||||||
|
"""
|
||||||
|
Return the value for all fields, or None.
|
||||||
|
:return: a dict with the field names and values
|
||||||
|
"""
|
||||||
|
return {field.field_name: field.value for field in self._instructions}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def all_found_fields_are_valid(self) -> bool:
|
def all_found_fields_are_valid(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -2678,6 +2678,7 @@ def test_parsing_flow_works_for_ad_html(real_ad_html):
|
||||||
assert (
|
assert (
|
||||||
parsing_flow.all_non_optional_fields_were_found
|
parsing_flow.all_non_optional_fields_were_found
|
||||||
and parsing_flow.all_found_fields_are_valid
|
and parsing_flow.all_found_fields_are_valid
|
||||||
|
and len(parsing_flow.field_values) == len(all_instructions)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue