added tests to Card.py

This commit is contained in:
2026-04-01 11:52:25 -04:00
parent 1b7352680b
commit e613278fa2

View File

@@ -19,4 +19,18 @@ class Card:
def __repr__(self) -> str:
return f"{self._value} of {self._suit}"
#Returns a string representation of the card in the format "Value of Suit".
#Returns a string representation of the card in the format "Value of Suit".
if __name__ == "__main__":
card1 = Card("Hearts", "Ace")
card2 = Card("Spades", "10")
assert card1.get_suit() == "Hearts"
assert card1.get_value() == "Ace"
assert card2.get_suit() == "Spades"
assert card2.get_value() == "10"
assert repr(card1) == "Ace of Hearts"
assert repr(card2) == "10 of Spades"
print("All Card tests passed.")