Check if two amount strings match within tolerance.
(gt_val: str, agent_val: str, tolerance: float)
| 120 | |
| 121 | |
| 122 | def amounts_match(gt_val: str, agent_val: str, tolerance: float) -> bool: |
| 123 | """Check if two amount strings match within tolerance.""" |
| 124 | gt = parse_amount(gt_val) |
| 125 | agent = parse_amount(agent_val) |
| 126 | if gt is None and agent is None: |
| 127 | return True |
| 128 | if gt is None or agent is None: |
| 129 | return False |
| 130 | return abs(gt - agent) <= tolerance |
| 131 | |
| 132 | |
| 133 | def normalize_string(val: str | None) -> str: |
no test coverage detected