(self, specification: Specification)
| 155 | self.set_style("reset") |
| 156 | |
| 157 | def report_specification(self, specification: Specification) -> None: |
| 158 | if specification.status is True: |
| 159 | self.set_style("bold", "green") |
| 160 | self.print("[PASS] ", end="") |
| 161 | elif specification.status is False: |
| 162 | self.set_style("bold", "red") |
| 163 | self.print("[FAIL] ", end="") |
| 164 | elif specification.status is None: |
| 165 | self.set_style("bold", "yellow") |
| 166 | self.print("[UNTESTED] ", end="") |
| 167 | |
| 168 | self.set_style("bold") |
| 169 | total = len(specification.applicable_entities) |
| 170 | total_successes = total - len(specification.failed_entities) |
| 171 | self.print(f"({total_successes}/{total}) ", end="") |
| 172 | |
| 173 | if specification.minOccurs != 0: |
| 174 | self.print(f"*", end="") |
| 175 | |
| 176 | self.print(specification.name) |
| 177 | |
| 178 | self.set_style("cyan") |
| 179 | self.print(" " * 4 + "Applies to:") |
| 180 | self.set_style("reset") |
| 181 | |
| 182 | for applicability in specification.applicability: |
| 183 | self.print(" " * 8 + applicability.to_string("applicability")) |
| 184 | |
| 185 | if not total and specification.status is False: |
| 186 | return |
| 187 | |
| 188 | self.set_style("cyan") |
| 189 | self.print(" " * 4 + "Requirements:") |
| 190 | self.set_style("reset") |
| 191 | |
| 192 | for requirement in specification.requirements: |
| 193 | self.set_style("reset") |
| 194 | self.set_style("red") if requirement.failures else self.set_style("green") |
| 195 | self.print(" " * 8 + requirement.to_string("requirement", specification, requirement)) |
| 196 | self.set_style("reset") |
| 197 | for failure in requirement.failures[0:10]: |
| 198 | self.print(" " * 12, end="") |
| 199 | self.report_reason(failure) |
| 200 | if len(requirement.failures) > 10: |
| 201 | self.print(" " * 12 + f"... {len(requirement.failures)} in total ...") |
| 202 | self.set_style("reset") |
| 203 | |
| 204 | def report_reason(self, failure: FacetFailure) -> None: |
| 205 | is_bold = False |
no test coverage detected