Minor fixes in parsing utils.

This commit is contained in:
pablo 2020-12-29 20:42:21 +01:00
parent 3b79ba06d8
commit cb553b5f7e
2 changed files with 9 additions and 0 deletions

View file

@ -498,6 +498,14 @@ class ParsingFlow:
for instruction in self._instructions:
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
def all_found_fields_are_valid(self) -> bool:
"""

View file

@ -2678,6 +2678,7 @@ def test_parsing_flow_works_for_ad_html(real_ad_html):
assert (
parsing_flow.all_non_optional_fields_were_found
and parsing_flow.all_found_fields_are_valid
and len(parsing_flow.field_values) == len(all_instructions)
)