def test_cmp_options(self): """ Test _cmp_options """ cqh = Card.from_text("Qh") ckh = Card.from_text("Kh") cah = Card.from_text("Ah") cks = Card.from_text("Ks") ckc = Card.from_text("Kc") kh_qh = set([ckh, cqh]) ah_kh = set([ckh, cah]) ks_kh = set([ckh, cks]) kh_kc = set([ckh, ckc]) self.assertEqual(-1, _cmp_options(kh_qh, ah_kh)) self.assertEqual(-1, _cmp_options(kh_qh, ks_kh)) self.assertEqual(-1, _cmp_options(kh_qh, kh_kc)) self.assertEqual(1, _cmp_options(ah_kh, kh_qh)) self.assertEqual(1, _cmp_options(ah_kh, ks_kh)) self.assertEqual(1, _cmp_options(ah_kh, kh_kc)) self.assertEqual(1, _cmp_options(ks_kh, kh_qh)) self.assertEqual(-1, _cmp_options(ks_kh, ah_kh)) self.assertEqual(1, _cmp_options(ks_kh, kh_kc)) self.assertEqual(1, _cmp_options(kh_kc, kh_qh)) self.assertEqual(-1, _cmp_options(kh_kc, ah_kh)) self.assertEqual(-1, _cmp_options(kh_kc, ks_kh))
def from_afei(cls, afei): """ Create from AnalysisFoldEquityItem """ cards = [Card.from_text(afei.higher_card), Card.from_text(afei.lower_card)] return cls(cards, afei.is_aggressive, afei.is_passive, afei.is_fold, afei.fold_ratio, afei.immediate_result, afei.semibluff_ev, afei.semibluff_equity)