import re


def _get_num_failed(test_output: str) -> int:
    """Get the amount of failed tests from the error output of JUnit4."""
    match = re.search(r"Failures: (\d+)", test_output)
    return int(match.group(1)) if match else 0