def testWhenCoinIsPassedInvalidWeightAndDiameterTheCoinIsInvalidAndHasProvidedWeightAndDiameter( self): aCoin = Coin(2.5, 0.75) # A penny self.assertEqual(aCoin.isValid(), False) self.assertEqual(aCoin.getWeight(), 2.5) self.assertEqual(aCoin.getDiameter(), 0.75)
def testWhenCoinIsPassValidWeightAndDiameterTheCoinIsValidAndHasProvidedWeightAndDiameter( self): nickel = Coin(Coins.NICKEL_WEIGHT, Coins.NICKEL_DIAMETER) # A nickel self.assertEqual(nickel.isValid(), True) self.assertEqual(nickel.getWeight(), Coins.NICKEL_WEIGHT) self.assertEqual(nickel.getDiameter(), Coins.NICKEL_DIAMETER) self.assertEqual(nickel.getValue(), Coins.NICKEL_VALUE) dime = Coin(Coins.DIME_WEIGHT, Coins.DIME_DIAMETER) # A dime self.assertEqual(dime.isValid(), True) self.assertEqual(dime.getWeight(), Coins.DIME_WEIGHT) self.assertEqual(dime.getDiameter(), Coins.DIME_DIAMETER) self.assertEqual(dime.getValue(), 0.1) quarter = Coin(Coins.QUARTER_WEIGHT, Coins.QUARTER_DIAMETER) # A quarter self.assertEqual(quarter.isValid(), True) self.assertEqual(quarter.getWeight(), Coins.QUARTER_WEIGHT) self.assertEqual(quarter.getDiameter(), Coins.QUARTER_DIAMETER) self.assertEqual(quarter.getValue(), Coins.QUARTER_VALUE)