def test_unicode(): assert str(Suit('c')) == '♣' assert str(Suit('d')) == '♦' assert str(Suit('h')) == '♥' assert str(Suit('s')) == '♠'
def test_str(): assert str(Suit('c')) == u'♣' assert str(Suit('d')) == u'♦' assert str(Suit('h')) == u'♥' assert str(Suit('s')) == u'♠'
def test_suit_order_reverse(): assert Suit('d') > Suit('c') assert Suit('h') > Suit('c') assert Suit('s') > Suit('c') assert Suit('h') > Suit('d') assert Suit('s') > Suit('d') assert Suit('s') > Suit('h') assert (Suit('d') < Suit('c')) is False assert (Suit('h') < Suit('c')) is False assert (Suit('s') < Suit('c')) is False assert (Suit('h') < Suit('d')) is False assert (Suit('s') < Suit('d')) is False assert (Suit('s') < Suit('h')) is False
def test_case_insensitive_reverse(): assert Suit('c') == Suit('C') assert Suit('d') > Suit('C') assert Suit('h') > Suit('C') assert Suit('s') > Suit('C') assert Suit('h') > Suit('D') assert Suit('s') > Suit('D') assert Suit('s') > Suit('H')
def test_make_random_is_instance_of_Suit(): assert isinstance(Suit.make_random(), Suit)
def test_putting_them_in_set_doesnt_raise_Exception(): {Suit('c')} {Suit.CLUBS, Suit.SPADES}
def test_suit_order_reverse(): assert Suit("d") > Suit("c") assert Suit("h") > Suit("c") assert Suit("s") > Suit("c") assert Suit("h") > Suit("d") assert Suit("s") > Suit("d") assert Suit("s") > Suit("h") assert (Suit("d") < Suit("c")) is False assert (Suit("h") < Suit("c")) is False assert (Suit("s") < Suit("c")) is False assert (Suit("h") < Suit("d")) is False assert (Suit("s") < Suit("d")) is False assert (Suit("s") < Suit("h")) is False
def test_suits_are_singletons(): assert Suit('c') is Suit.CLUBS assert Suit('c') is Suit('c') assert Suit('c') is Suit('♣') assert Suit('s') is Suit.SPADES
def test_hash(): assert hash(Suit.CLUBS) == hash(Suit("c")) == hash(Suit("C")) == hash( Suit("♣")) assert hash(Suit.SPADES) == hash(Suit("s"))
def test_unicode_suit_order(): assert Suit("♣") < Suit("♦") assert Suit("♣") < Suit("♥") assert Suit("♣") < Suit("♠") assert Suit("♦") < Suit("♥") assert Suit("♦") < Suit("♠") assert Suit("♥") < Suit("♠")
def test_suits_are_singletons(): assert Suit("c") is Suit.CLUBS assert Suit("c") is Suit("c") assert Suit("c") is Suit("♣") assert Suit("s") is Suit.SPADES
def test_class_is_iterable(): assert list(Suit) == [Suit('♣'), Suit('♦'), Suit('♥'), Suit('♠')] assert list(Suit) == list(tuple(Suit))
def test_repr(): assert repr(Suit('c')) == "Suit('♣')" assert repr(Suit('d')) == "Suit('♦')" assert repr(Suit('h')) == "Suit('♥')" assert repr(Suit('s')) == "Suit('♠')"
def test_str(): assert str(Suit('c')) == '♣' == b'\xe2\x99\xa3'.decode('utf-8') assert str(Suit('d')) == '♦' == b'\xe2\x99\xa6'.decode('utf-8') assert str(Suit('h')) == '♥' == b'\xe2\x99\xa5'.decode('utf-8') assert str(Suit('s')) == '♠' == b'\xe2\x99\xa0'.decode('utf-8')
def test_case_insensitive(): assert Suit("C") == Suit("c") assert Suit("C") < Suit("d") assert Suit("C") < Suit("h") assert Suit("C") < Suit("s") assert Suit("D") < Suit("h") assert Suit("D") < Suit("s") assert Suit("H") < Suit("s")
def test_case_insensitive(): assert Card('aH').rank == Rank('A') assert Card('aH').suit == Suit('h') == Suit('♥')
def test_suit_order(): assert Suit("c") < Suit("d") assert Suit("c") < Suit("h") assert Suit("c") < Suit("s") assert Suit("d") < Suit("h") assert Suit("d") < Suit("s") assert Suit("h") < Suit("s")
def test_suits_are_pickable(): assert pickle.loads(pickle.dumps(Suit('c'))) == Suit('c') assert pickle.loads(pickle.dumps(Suit('c'))) is Suit('c')
def test_case_insensitive_reverse(): assert Suit("c") == Suit("C") assert Suit("d") > Suit("C") assert Suit("h") > Suit("C") assert Suit("s") > Suit("C") assert Suit("h") > Suit("D") assert Suit("s") > Suit("D") assert Suit("s") > Suit("H")
def test_hash(): assert (hash(Suit.CLUBS) == hash(Suit('c')) == hash(Suit('C')) == hash( Suit('♣'))) assert hash(Suit.SPADES) == hash(Suit('s'))
def test_str(): assert str(Suit("c")) == "♣" assert str(Suit("d")) == "♦" assert str(Suit("h")) == "♥" assert str(Suit("s")) == "♠"
def test_unicode_suit_order(): assert Suit('♣') < Suit('♦') assert Suit('♣') < Suit('♥') assert Suit('♣') < Suit('♠') assert Suit('♦') < Suit('♥') assert Suit('♦') < Suit('♠') assert Suit('♥') < Suit('♠')
def test_repr(): assert repr(Suit("c")) == "Suit('♣')" assert repr(Suit("d")) == "Suit('♦')" assert repr(Suit("h")) == "Suit('♥')" assert repr(Suit("s")) == "Suit('♠')"
def test_case_insensitive(): assert Suit('C') == Suit('c') assert Suit('C') < Suit('d') assert Suit('C') < Suit('h') assert Suit('C') < Suit('s') assert Suit('D') < Suit('h') assert Suit('D') < Suit('s') assert Suit('H') < Suit('s')
def test_class_is_iterable(): assert list(Suit) == [Suit("♣"), Suit("♦"), Suit("♥"), Suit("♠")] assert list(Suit) == list(tuple(Suit))
def test_wrong_value_raises_ValueError(): with pytest.raises(ValueError): Suit('k')
def test_unicode_suits(): assert Card('A♠') > Card('Kd') assert Card('K♥') > Card('Kc') assert Card('aH').suit == Suit('♥') assert Card('2d').suit == Suit('♦')
def test_suit_order(): assert Suit('c') < Suit('d') assert Suit('c') < Suit('h') assert Suit('c') < Suit('s') assert Suit('d') < Suit('h') assert Suit('d') < Suit('s') assert Suit('h') < Suit('s')
def test_suit(): assert Card('Ac').suit == Suit('c')
def test_case_insensitive(): assert Card("aH").rank == Rank("A") assert Card("aH").suit == Suit("h") == Suit("♥")