|
6 | 6 | from assertionengine import AssertionOperator, verify_assertion |
7 | 7 | from assertionengine.assertion_engine import EvaluationOperators, NumericalOperators |
8 | 8 | from robot.api.deco import keyword |
| 9 | +from robot.api.exceptions import ContinuableFailure |
9 | 10 |
|
10 | 11 | from ..general.library_attributes import LibraryAttributes |
11 | 12 | from ..utils.file_access import FileAccess |
@@ -347,13 +348,14 @@ def get_table_row( |
347 | 348 | return row_list |
348 | 349 |
|
349 | 350 | @keyword(tags=["Getter"]) |
350 | | - def count_table( |
| 351 | + def count_table( # noqa: PLR0913 |
351 | 352 | self, |
352 | 353 | path: Path | str, |
353 | 354 | axis: Axis, |
354 | 355 | assertion_operator: AssertionOperator | None = None, |
355 | 356 | assertion_expected: Any = None, |
356 | 357 | message: str = "", |
| 358 | + continue_on_failure: bool = True, |
357 | 359 | ) -> int: |
358 | 360 | """ |
359 | 361 | Keyword for counting rows or columns in the provided table. |
@@ -403,9 +405,17 @@ def count_table( |
403 | 405 | or |
404 | 406 | assertion_operator in EvaluationOperators |
405 | 407 | ): |
406 | | - verify_assertion(axis_count, assertion_operator, assertion_expected, message) |
| 408 | + try: |
| 409 | + verify_assertion(axis_count, assertion_operator, assertion_expected, message) |
| 410 | + except AssertionError as e: |
| 411 | + err = message if message else str(e) |
| 412 | + if not continue_on_failure: |
| 413 | + raise AssertionError(err) # noqa: B904 |
| 414 | + raise ContinuableFailure(err) # noqa: B904 |
| 415 | + except Exception: |
| 416 | + raise |
407 | 417 | else: |
408 | 418 | raise ValueError( |
409 | | - f"Unexpected operator for assertion: {assertion_operator}. Use only {list(NumericalOperators)}." |
| 419 | + f"Unexpected operator for assertion: {assertion_operator}. Use only {list(NumericalOperators)} or {list(EvaluationOperators)}." |
410 | 420 | ) |
411 | 421 | return axis_count |
0 commit comments