# Path: athlib/highjump.py
# class Jumper(object):
# class TrialObj(dict):
# class HighJumpCompetition(object):
#     def __init__(self, **kwargs):
#     def _set_jump_array(self, height_count: int, label : str = 'jump') -> None:
#     def has_retired(self):
#     def ranking_key(self) -> Tuple[int, Decimal, int, int]:
#     def cleared(self, height_count: int, height: Decimal) -> None:
#     def failed(self, height_count: int, height: Decimal) -> None:
#     def passed(self, height_count: int, height: Decimal) -> None:
#     def retired(self, height_count: int, height: Decimal) -> None:
#     def __init__(self, *args, **kwargs):
#     def __init__(self):
#     def add_jumper(self, **kwargs) -> None:
#     def set_bar_height(self, new_height: Decimal) -> None:
#     def check_started(self, bib: str, label: str = 'jumping') -> Jumper:
#     def cleared(self, bib: str) -> None:
#     def failed(self, bib: str) -> None:
#     def passed(self, bib: str) -> None:
#     def retired(self, bib: str) -> None:
#     def trials(self) -> List[Tuple[str, Decimal, str]]:
#     def trial_objs(self) -> List[TrialObj]:
#     def remaining(self) -> List[Jumper]:
#     def eliminated(self) -> List[Jumper]:
#     def _rankj(self) -> List[Jumper]:
#     def _rank(self, verbose: bool = False) -> None:
#     def bib_trial(self, bib: str, trial: str) -> None:
#     def from_matrix(cls, matrix: List[List[str]], to_nth_height: int = None, verbose: bool = False) -> HighJumpCompetition:
#     def _looks_like_height(self, txt:str) -> bool:
#     def _ensure_dicts_ordered(self, dikts: List[Dict[str, str]]) -> None:
#     def print_ranking(self):
#     def from_actions(self, actions: List[Tuple] = None) -> HighJumpCompetition:
#     def to_matrix(self, keys: List[str] = []) -> List[List[str]]:
#     def is_finished(self) -> bool:
#     def is_running(self) -> bool:
#         T = []
#         R = [keys + ['%.2f'%h for h in self.heights]]
#         J = sorted([([getattr(j,k) for k in keys],j) for j in self.ranked_jumpers])
# 
# Path: athlib/exceptions.py
# class RuleViolation(Exception):
#     """Exception to indicate incorrect athletics logic
# 
#     This may be used if, for example, there is a fourth
#     attempt at a high jump.  We use this as a form of
#     assertion within the code; others are welcome to as well.
#     """
#     pass


from unittest import TestCase, main
from decimal import Decimal
from athlib.highjump import HighJumpCompetition, _012
from athlib.exceptions import RuleViolation
        self.assertEqual(england.highest_cleared, Decimal("2.11"))

        self.assertRaises(RuleViolation,c.set_bar_height, Decimal("2.12"))

    def test_countback_to_tie(self):
        "Run both fail, but tie countback wins"
        c = HighJumpCompetition.from_matrix(
                [
                ["place", "order", "bib", "first_name", "last_name", "2.06", "2.08", "2.10", "2.12", "2.14"],
                ["",      1,       'A',  "Harald", "England",        "o",    "o",    "xo",   "xo",   "xxx"],
                ["",      2,       'B',  "William", "Norman",        "o",    "o",    "o",    "xxo",  "xxx"],
                ]
                )
        self.assertRaises(RuleViolation,c.failed,'A')
        self.assertRaises(RuleViolation,c.failed,'B')

        # see who is winning
        A = c.jumpers_by_bib['A']
        B = c.jumpers_by_bib['B']
        self.assertEqual(A.place, 1)
        self.assertEqual(B.place, 2)
        self.assertEqual(len(c.remaining), 0)
        self.assertEqual(c.state, 'finished')
        self.assertEqual(A.highest_cleared, Decimal("2.12"))
        self.assertEqual(B.highest_cleared, Decimal("2.12"))
        self.assertEqual(A.ranking_key,(2, Decimal('-2.12'), 1, 2))
        self.assertEqual(B.ranking_key,(2, Decimal('-2.12'), 2, 2))

    def test_countback_total_failure_rank(self):
        "test_countback_total_failure_rank"

# Path: athlib/highjump.py
# class Jumper(object):
# class TrialObj(dict):
# class HighJumpCompetition(object):
#     def __init__(self, **kwargs):
#     def _set_jump_array(self, height_count: int, label : str = 'jump') -> None:
#     def has_retired(self):
#     def ranking_key(self) -> Tuple[int, Decimal, int, int]:
#     def cleared(self, height_count: int, height: Decimal) -> None:
#     def failed(self, height_count: int, height: Decimal) -> None:
#     def passed(self, height_count: int, height: Decimal) -> None:
#     def retired(self, height_count: int, height: Decimal) -> None:
#     def __init__(self, *args, **kwargs):
#     def __init__(self):
#     def add_jumper(self, **kwargs) -> None:
#     def set_bar_height(self, new_height: Decimal) -> None:
#     def check_started(self, bib: str, label: str = 'jumping') -> Jumper:
#     def cleared(self, bib: str) -> None:
#     def failed(self, bib: str) -> None:
#     def passed(self, bib: str) -> None:
#     def retired(self, bib: str) -> None:
#     def trials(self) -> List[Tuple[str, Decimal, str]]:
#     def trial_objs(self) -> List[TrialObj]:
#     def remaining(self) -> List[Jumper]:
#     def eliminated(self) -> List[Jumper]:
#     def _rankj(self) -> List[Jumper]:
#     def _rank(self, verbose: bool = False) -> None:
#     def bib_trial(self, bib: str, trial: str) -> None:
#     def from_matrix(cls, matrix: List[List[str]], to_nth_height: int = None, verbose: bool = False) -> HighJumpCompetition:
#     def _looks_like_height(self, txt:str) -> bool:
#     def _ensure_dicts_ordered(self, dikts: List[Dict[str, str]]) -> None:
#     def print_ranking(self):
#     def from_actions(self, actions: List[Tuple] = None) -> HighJumpCompetition:
#     def to_matrix(self, keys: List[str] = []) -> List[List[str]]:
#     def is_finished(self) -> bool:
#     def is_running(self) -> bool:
#         T = []
#         R = [keys + ['%.2f'%h for h in self.heights]]
#         J = sorted([([getattr(j,k) for k in keys],j) for j in self.ranked_jumpers])
# 
# Path: athlib/exceptions.py
# class RuleViolation(Exception):
#     """Exception to indicate incorrect athletics logic
# 
#     This may be used if, for example, there is a fourth
#     attempt at a high jump.  We use this as a form of
#     assertion within the code; others are welcome to as well.
#     """
#     pass


# Path: tests/test_highjump.py
from unittest import TestCase, main
from decimal import Decimal
from athlib.highjump import HighJumpCompetition, _012
from athlib.exceptions import RuleViolation

        self.assertEqual(england.highest_cleared, Decimal("2.11"))

        self.assertRaises(RuleViolation,c.set_bar_height, Decimal("2.12"))

    def test_countback_to_tie(self):
        "Run both fail, but tie countback wins"
        c = HighJumpCompetition.from_matrix(
                [
                ["place", "order", "bib", "first_name", "last_name", "2.06", "2.08", "2.10", "2.12", "2.14"],
                ["",      1,       'A',  "Harald", "England",        "o",    "o",    "xo",   "xo",   "xxx"],
                ["",      2,       'B',  "William", "Norman",        "o",    "o",    "o",    "xxo",  "xxx"],
                ]
                )
        self.assertRaises(RuleViolation,c.failed,'A')
        self.assertRaises(RuleViolation,c.failed,'B')

        # see who is winning
        A = c.jumpers_by_bib['A']
        B = c.jumpers_by_bib['B']
        self.assertEqual(A.place, 1)
        self.assertEqual(B.place, 2)
        self.assertEqual(len(c.remaining), 0)
        self.assertEqual(c.state, 'finished')
        self.assertEqual(A.highest_cleared, Decimal("2.12"))
        self.assertEqual(B.highest_cleared, Decimal("2.12"))
        self.assertEqual(A.ranking_key,(2, Decimal('-2.12'), 1, 2))
        self.assertEqual(B.ranking_key,(2, Decimal('-2.12'), 2, 2))

    def test_countback_total_failure_rank(self):
        "test_countback_total_failure_rank"

        c = HighJumpCompetition.from_matrix(