added tests to Card.py
This commit is contained in:
@@ -19,4 +19,18 @@ class Card:
|
|||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f"{self._value} of {self._suit}"
|
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.")
|
||||||
Reference in New Issue
Block a user