Answered step by step
Verified Expert Solution
Question
1 Approved Answer
HW 2 (due date: Monday, 02/10) Write unit tests to test the methods suit, suitName and rankNameof Card class See the Chapter2-unitTestingCardHW.py #unitTestingCard.py # unit
HW 2 (due date: Monday, 02/10) Write unit tests to test the methods suit, suitName and rankNameof Card class See the Chapter2-unitTestingCardHW.py #unitTestingCard.py # unit testing rank import sys import unittest from Card import . class RankTest(unittest. Testcase) *** Tests Rank methods: rank() and rankName() *** def testRanks(self): *** creates cards of rank 1 through 13 of clubs and verifies that the created card's rank is equal to the rank it was created with ** for i in range(1,14): my Card - Card(i,'c') # create i of clubs self.assertEqual(myCard.rank(), i) # verifies that the card's rank is i class Suit Test (unittest. Test Case): *** Tests Suit methods: suit and suitName() "*" def test Suits (self): "*" creates cards of rank ... ofc (clubs), d (diamonds), h(hearts) and s (spades), and verifies that the created card's is equal to the suit it was created with (c,d,h,s)" pass def main(argv): unittest.main() if _name__ == main(sys.argy). main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started