@@ -25,6 +25,7 @@ class CoverageRunner:
2525 mapping_suite : MappingSuite
2626 mapping_suite_id : str
2727 conceptual_xpaths : Set [str ] = set ()
28+ conceptual_remarked_xpaths : Set [str ] = set ()
2829 conceptual_xpath_data : Dict [str , ConceptualMappingXPATH ] = {}
2930 base_xpath : str
3031
@@ -41,6 +42,13 @@ def notice_xpaths(self, notice: Notice) -> List[str]:
4142 return notice .xml_metadata .unique_xpaths
4243
4344 def init_xpath_data (self , conceptual_mapping : ConceptualMapping ):
45+ for cm_xpath in conceptual_mapping .mapping_remarks :
46+ for xpath in cm_xpath .field_xpath :
47+ self .conceptual_remarked_xpaths .add (xpath )
48+ self .conceptual_xpath_data [xpath ] = ConceptualMappingXPATH (
49+ xpath = xpath ,
50+ form_field = f"{ cm_xpath .standard_form_field_id } - { cm_xpath .standard_form_field_name } "
51+ )
4452 for cm_xpath in conceptual_mapping .xpaths :
4553 self .conceptual_xpaths .add (cm_xpath .xpath )
4654 self .conceptual_xpath_data [cm_xpath .xpath ] = cm_xpath
@@ -63,10 +71,13 @@ def find_notice_by_xpath(cls, notice_xpaths: XPathDict, xpath: str) -> Dict[str,
6371 notice_hit : Dict [str , int ] = {k : v .count (xpath ) for k , v in sorted (notice_xpaths .items ()) if xpath in v }
6472 return notice_hit
6573
74+ def get_all_conceptual_xpaths (self ) -> Set [str ]:
75+ return self .conceptual_remarked_xpaths | self .conceptual_xpaths
76+
6677 def xpath_assertions (self , notice_xpaths : XPathDict ,
6778 xpaths_list : List [str ]) -> List [XPATHCoverageValidationAssertion ]:
6879 xpath_assertions = []
69- for xpath in self .conceptual_xpaths :
80+ for xpath in self .get_all_conceptual_xpaths () :
7081 xpath_assertion = XPATHCoverageValidationAssertion ()
7182 xpath_data = self .conceptual_xpath_data [xpath ]
7283 form_field = xpath_data .form_field
@@ -85,8 +96,10 @@ def validate_xpath_coverage_report(self, report: XPATHCoverageValidationReport,
8596 validation_result : XPATHCoverageValidationResult = XPATHCoverageValidationResult ()
8697 validation_result .xpath_assertions = self .xpath_assertions (notice_xpaths , xpaths_list )
8798 validation_result .xpath_covered = sorted (list (self .conceptual_xpaths & unique_notice_xpaths ))
88- validation_result .xpath_not_covered = sorted (list (unique_notice_xpaths - self .conceptual_xpaths ))
89- validation_result .xpath_extra = sorted (list (self .conceptual_xpaths - unique_notice_xpaths ))
99+ all_conceptual_xpaths = self .get_all_conceptual_xpaths ()
100+ validation_result .xpath_not_covered = sorted (list (unique_notice_xpaths - all_conceptual_xpaths ))
101+ validation_result .xpath_extra = sorted (list (all_conceptual_xpaths - unique_notice_xpaths ))
102+ validation_result .remarked_xpaths = sorted (list (self .conceptual_remarked_xpaths ))
90103 unique_notice_xpaths_len = len (unique_notice_xpaths )
91104 xpath_covered_len = len (validation_result .xpath_covered )
92105 conceptual_xpaths_len = len (self .conceptual_xpaths )
@@ -139,4 +152,3 @@ def html_report(cls, report: XPATHCoverageValidationReport, metadata: dict = Non
139152 data [TEMPLATE_METADATA_KEY ] = metadata
140153 html_report = TEMPLATES .get_template (XPATH_COVERAGE_REPORT_TEMPLATE ).render (data )
141154 return html_report
142-
0 commit comments