# Path: poker/card.py
# class Card(_ReprMixin, metaclass=_CardMeta):
#     """Represents a Card, which consists a Rank and a Suit."""
# 
#     __slots__ = ("rank", "suit")
# 
#     def __new__(cls, card):
#         if isinstance(card, cls):
#             return card
# 
#         if len(card) != 2:
#             raise ValueError("length should be two in %r" % card)
# 
#         self = object.__new__(cls)
#         self.rank = Rank(card[0])
#         self.suit = Suit(card[1])
#         return self
# 
#     def __hash__(self):
#         return hash(self.rank) + hash(self.suit)
# 
#     def __eq__(self, other):
#         if self.__class__ is other.__class__:
#             return self.rank == other.rank and self.suit == other.suit
#         return NotImplemented
# 
#     def __lt__(self, other):
#         if self.__class__ is not other.__class__:
#             return NotImplemented
# 
#         # with same ranks, suit counts
#         if self.rank == other.rank:
#             return self.suit < other.suit
#         return self.rank < other.rank
# 
#     def __str__(self):
#         return f"{self.rank}{self.suit}"
# 
#     @property
#     def is_face(self):
#         return self.rank in FACE_RANKS
# 
#     @property
#     def is_broadway(self):
#         return self.rank in BROADWAY_RANKS
# 
# class Rank(PokerEnum):
#     DEUCE = "2", 2
#     THREE = "3", 3
#     FOUR = "4", 4
#     FIVE = "5", 5
#     SIX = "6", 6
#     SEVEN = "7", 7
#     EIGHT = "8", 8
#     NINE = "9", 9
#     TEN = "T", 10
#     JACK = ("J",)
#     QUEEN = ("Q",)
#     KING = ("K",)
#     ACE = "A", 1
# 
#     @classmethod
#     def difference(cls, first, second):
#         """Tells the numerical difference between two ranks."""
# 
#         # so we always get a Rank instance even if string were passed in
#         first, second = cls(first), cls(second)
#         rank_list = list(cls)
#         return abs(rank_list.index(first) - rank_list.index(second))
# 
# class Suit(PokerEnum):
#     CLUBS = "♣", "c", "clubs"
#     DIAMONDS = "♦", "d", "diamonds"
#     HEARTS = "♥", "h", "hearts"
#     SPADES = "♠", "s", "spades"
#     # Can't make alias with redefined value property
#     # because of a bug in stdlib enum module (line 162)
#     # C = '♣', 'c', 'C', 'clubs'


import pytest
from poker.card import Card, Rank, Suit
    assert Card("Ad").rank != Card("Ks").rank
    assert Card("Ts").rank != Card("5h").rank


def test_rank_comparisons():
    assert Card("Ac").rank > Card("Kh").rank
    assert Card("Ks").rank > Card("Qd").rank
    assert Card("Qs").rank > Card("Js").rank
    assert Card("Jd").rank > Card("Th").rank
    assert Card("Ac").rank > Card("2s").rank


def test_rank_comparisons_reverse():
    assert Card("Kh").rank < Card("Ac").rank
    assert Card("Qd").rank < Card("Ks").rank
    assert Card("Js").rank < Card("Qs").rank
    assert Card("Th").rank < Card("Jd").rank
    assert Card("2s").rank < Card("Ac").rank


def test_suit():
    assert Card("Ac").suit == Suit("c")


def test_rank():
    assert Card("Ah").rank == Rank("A")


def test_case_insensitive():
    assert Card("aH").rank == Rank("A")

# Path: poker/card.py
# class Card(_ReprMixin, metaclass=_CardMeta):
#     """Represents a Card, which consists a Rank and a Suit."""
# 
#     __slots__ = ("rank", "suit")
# 
#     def __new__(cls, card):
#         if isinstance(card, cls):
#             return card
# 
#         if len(card) != 2:
#             raise ValueError("length should be two in %r" % card)
# 
#         self = object.__new__(cls)
#         self.rank = Rank(card[0])
#         self.suit = Suit(card[1])
#         return self
# 
#     def __hash__(self):
#         return hash(self.rank) + hash(self.suit)
# 
#     def __eq__(self, other):
#         if self.__class__ is other.__class__:
#             return self.rank == other.rank and self.suit == other.suit
#         return NotImplemented
# 
#     def __lt__(self, other):
#         if self.__class__ is not other.__class__:
#             return NotImplemented
# 
#         # with same ranks, suit counts
#         if self.rank == other.rank:
#             return self.suit < other.suit
#         return self.rank < other.rank
# 
#     def __str__(self):
#         return f"{self.rank}{self.suit}"
# 
#     @property
#     def is_face(self):
#         return self.rank in FACE_RANKS
# 
#     @property
#     def is_broadway(self):
#         return self.rank in BROADWAY_RANKS
# 
# class Rank(PokerEnum):
#     DEUCE = "2", 2
#     THREE = "3", 3
#     FOUR = "4", 4
#     FIVE = "5", 5
#     SIX = "6", 6
#     SEVEN = "7", 7
#     EIGHT = "8", 8
#     NINE = "9", 9
#     TEN = "T", 10
#     JACK = ("J",)
#     QUEEN = ("Q",)
#     KING = ("K",)
#     ACE = "A", 1
# 
#     @classmethod
#     def difference(cls, first, second):
#         """Tells the numerical difference between two ranks."""
# 
#         # so we always get a Rank instance even if string were passed in
#         first, second = cls(first), cls(second)
#         rank_list = list(cls)
#         return abs(rank_list.index(first) - rank_list.index(second))
# 
# class Suit(PokerEnum):
#     CLUBS = "♣", "c", "clubs"
#     DIAMONDS = "♦", "d", "diamonds"
#     HEARTS = "♥", "h", "hearts"
#     SPADES = "♠", "s", "spades"
#     # Can't make alias with redefined value property
#     # because of a bug in stdlib enum module (line 162)
#     # C = '♣', 'c', 'C', 'clubs'


# Path: tests/test_card.py
import pytest
from poker.card import Card, Rank, Suit

    assert Card("Ad").rank != Card("Ks").rank
    assert Card("Ts").rank != Card("5h").rank


def test_rank_comparisons():
    assert Card("Ac").rank > Card("Kh").rank
    assert Card("Ks").rank > Card("Qd").rank
    assert Card("Qs").rank > Card("Js").rank
    assert Card("Jd").rank > Card("Th").rank
    assert Card("Ac").rank > Card("2s").rank


def test_rank_comparisons_reverse():
    assert Card("Kh").rank < Card("Ac").rank
    assert Card("Qd").rank < Card("Ks").rank
    assert Card("Js").rank < Card("Qs").rank
    assert Card("Th").rank < Card("Jd").rank
    assert Card("2s").rank < Card("Ac").rank


def test_suit():
    assert Card("Ac").suit == Suit("c")


def test_rank():
    assert Card("Ah").rank == Rank("A")


def test_case_insensitive():
    assert Card("aH").rank == Rank("A")

    assert Card("aH").suit == Suit("h") == Suit("♥")