Beispiel #1
0
 def test_pairs_from_hands(self):
     assert Range.from_objects({Hand('AA'), Hand('KK'), Hand('QQ')}) == Range('QQ+')
Beispiel #2
0
 def test_pairs_with_dash_are_equal_with_spaces(self):
     assert Range('22-33').combos == Range('22 33').combos
     assert Range('55-33').combos == Range('33 44 55').combos
Beispiel #3
0
 def test_offsuit(self):
     assert Range('AkO') == Range('AKo')
Beispiel #4
0
    def test_empty_range(self):
        assert Range().hands == tuple()
        assert Range().combos == tuple()

        assert Range('').hands == tuple()
        assert Range('').combos == tuple()
Beispiel #5
0
 def test_pairs_multiple(self):
     assert Range('22 33').combos == DEUCE_COMBOS + THREE_COMBOS
Beispiel #6
0
 def test_suited_plus(self):
     assert Range('KJs+').hands == (Hand('KJs'), Hand('KQs'))
Beispiel #7
0
 def test_offsuit_and_suited_dashed(self):
     assert Range('J8-J4').hands == (Hand('J4o'), Hand('J4s'), Hand('J5o'),
                                     Hand('J5s'), Hand('J6o'), Hand('J6s'),
                                     Hand('J7o'), Hand('J7s'), Hand('J8o'),
                                     Hand('J8s'))
Beispiel #8
0
def test_pickable():
    assert pickle.loads(pickle.dumps(Range('Ako 22+'))) == Range('AKo 22+')
Beispiel #9
0
 def test_pairs_with_dash_reverse(self):
     assert Range('55-22').hands == (Hand('22'), Hand('33'), Hand('44'), Hand('55'))
     assert Range('33-22').hands == (Hand('22'), Hand('33'))
Beispiel #10
0
 def test_wrong_str_in_range_raises_ValueError(self):
     with pytest.raises(ValueError):
         assert 'AKl' in Range('AQo+')
Beispiel #11
0
 def test_pairs_with_dash(self):
     assert Range('22-55').hands == (Hand('22'), Hand('33'), Hand('44'), Hand('55'))
     assert Range('22-33').hands == (Hand('22'), Hand('33'))
Beispiel #12
0
 def test_str_in_range(self):
     assert 'AKo' in Range('AQo+')
Beispiel #13
0
 def test_hand_in_range(self):
     assert Hand('Ako') in Range('AQo+')
Beispiel #14
0
 def test_combo_in_range(self):
     assert Combo('2s2c') in Range('22')
Beispiel #15
0
 def test_from_percent(self):
     assert Range.from_percent(0.9) == Range('KK+')
Beispiel #16
0
 def test_multiple_offsuit_hands(self):
     assert Range('AKo 84o').hands == (Hand('84o'), Hand('AKo'))
Beispiel #17
0
 def test_offsuit_hand(self):
     assert bool(Range('AKo')) is True
Beispiel #18
0
 def test_hands_without_suit(self):
     assert Range('AK 48').hands == (Hand('84o'), Hand('84s'), Hand('AKo'), Hand('AKs'))
Beispiel #19
0
 def test_suited_minus(self):
     assert Range('76s-').hands == (Hand('72s'), Hand('73s'), Hand('74s'),
                                    Hand('75s'), Hand('76s'))
Beispiel #20
0
 def test_dash_offsuit(self):
     assert Range('J8o-J4o').hands == (Hand('J4o'), Hand('J5o'), Hand('J6o'),
                                       Hand('J7o'), Hand('J8o'))
Beispiel #21
0
 def test_offsuit_and_suited_with_dash_reversed_is_the_same(self):
     assert Range('J8-J4').hands == Range('J4-J8').hands
Beispiel #22
0
 def test_dash_suited(self):
     assert Range('J8s-J4s').hands == (Hand('J4s'), Hand('J5s'), Hand('J6s'),
                                       Hand('J7s'), Hand('J8s'))
Beispiel #23
0
 def test_pairs_simple(self):
     """Test if pairs get all the combos."""
     assert Range('22').combos == DEUCE_COMBOS
Beispiel #24
0
 def test_pairs_backward(self):
     assert Range('44-').hands == (Hand('22'), Hand('33'), Hand('44'))
Beispiel #25
0
 def test_pairs_with_dash(self):
     assert Range('22-33').combos == DEUCE_COMBOS + THREE_COMBOS
Beispiel #26
0
 def test_both_suits_with_minus(self):
     assert Range('A5-').hands == (Hand('A2o'), Hand('A2s'), Hand('A3o'), Hand('A3s'),
                                   Hand('A4o'), Hand('A4s'), Hand('A5o'), Hand('A5s'))
Beispiel #27
0
 def test_pairs(self):
     assert Range('aA') == Range('AA')
     assert Range('TT') == Range('tt')
Beispiel #28
0
 def test_both_suits_with_plus(self):
     assert Range('A5+').hands == (
         Hand('A5o'), Hand('A5s'), Hand('A6o'), Hand('A6s'), Hand('A7o'), Hand('A7s'),
         Hand('A8o'), Hand('A8s'), Hand('A9o'), Hand('A9s'), Hand('ATo'), Hand('ATs'),
         Hand('AJo'), Hand('AJs'), Hand('AQo'), Hand('AQs'), Hand('AKo'), Hand('AKs')
     )
Beispiel #29
0
 def test_suited(self):
     assert Range('AKs') == Range('kaS')
Beispiel #30
0
 def test_offsuit_plus(self):
     assert Range('KJo+').hands == (Hand('KJo'), Hand('KQo'))
Beispiel #31
0
 def test_from_combos(self):
     range = Range.from_objects(DEUCE_COMBOS)
     assert range == Range('22')
     assert range.combos == DEUCE_COMBOS
     assert range.hands == (Hand('22'),)
Beispiel #32
0
 def test_offsuit_minus(self):
     assert Range('76o-').hands == (Hand('72o'), Hand('73o'), Hand('74o'),
                                    Hand('75o'), Hand('76o'))
Beispiel #33
0
 def test_from_percent_comparison(self):
     # both represents 0.9%, but they should not be equal
     assert Range('AKo') != Range.from_percent(0.9)
Beispiel #34
0
 def test_hand_combination(self):
     assert bool(Range('AhKs')) is True