def test_pricing_free_B(self):
     # We need to test that we don't get more than the number of B that are in the checkout
     self.assertEqual(checkout("EEB"), 40 + 40)
     self.assertEqual(checkout("EE"), 40 + 40)
     self.assertEqual(checkout("EEEEEEB"), 40 * 6)
     self.assertEqual(checkout("EEBB"), 40 + 40 + 30)
     self.assertEqual(checkout("EEBBBB"), 40 + 40 + 45 + 30)
    def test_checkout(self):
        self.assertEqual(checkout('AAABBCD'), 210)

        self.assertEqual(checkout('AAAABBC'), 245)

        self.assertEqual(checkout('&'), -1)

        self.assertEqual(checkout('CCC'), 60)
 def test_group_discount(self):
     self.assertEqual(checkout('ST'), 40)
     self.assertEqual(checkout('TY'), 40)
     self.assertEqual(checkout('ZZS'), 45)
     self.assertEqual(checkout('TTX'), 45)
     self.assertEqual(checkout('XXX'), 45)
     self.assertEqual(checkout('TXY'), 45)
     self.assertEqual(checkout('TXYS'), 62)
     self.assertEqual(checkout('ZSTY'), 65)
     self.assertEqual(checkout('ZZZY'), 65)
     self.assertEqual(checkout('ZXZZ'), 62)
 def test_A_new_discount(self):
     self.assertEqual(checkout('AAAA'), 180)
     self.assertEqual(checkout('AAAAA'), 200)
     self.assertEqual(checkout('AAAAAA'), 250)
     self.assertEqual(checkout('AAAAAAA'), 300)
     self.assertEqual(checkout('AAAAAAAA'), 330)
     self.assertEqual(checkout('AAAAAAAAA'), 380)
     self.assertEqual(checkout('AAAAAAAAAA'), 400)
 def test_F_discount(self):
     self.assertEqual(checkout('F'), 10)
     self.assertEqual(checkout('FF'), 20)
     self.assertEqual(checkout('FFF'), 20)
     self.assertEqual(checkout('FFFF'), 30)
     self.assertEqual(checkout('FFFFF'), 40)
     self.assertEqual(checkout('FFFFFF'), 40)
 def test_pricing_multi_A(self):
     self.assertEqual(checkout("AAA"), 130)
     self.assertEqual(checkout("AABA"), 130 + 30)
     self.assertEqual(checkout("BACDAA"), 130 + 30 + 20 + 15)
     self.assertEqual(checkout("AAAAA"), 200)
     self.assertEqual(checkout("AAAAAAAAAA"), 400)
     self.assertEqual(checkout("AAAAAAAAAAAAA"), 530)
Beispiel #7
0
    def test_checkout_single_b(self):
        self.assertEqual(checkout("B"), 30)

        def test_checkout_list_input(self):
            self.assertEqual(checkout(["B"]), 30)

        def test_checkout_lower_input(self):
            self.assertEqual(checkout("b"), -1)

        def test_checkout_mixed_input(self):
            self.assertEqual(checkout("AbC"), -1)

        def test_checkout_punct(self):
            self.assertEqual(checkout("!,."), -1)
 def test_checkout(self):
     assert checkout("FFFFFF") == 40
 def test_checkout(self):
     assert checkout("AC") == 70
 def test_checkout(self):
     assert checkout("EE") == 80
 def test_checkout(self):
     assert checkout("BBB") == 75
 def test_checkout(self):
     assert checkout("A") == 50
 def test_checkout(self):
     assert checkout("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ") == 1602
Beispiel #14
0
 def test_checkout_illegal(self):
     self.assertEqual(checkout(15), -1)
Beispiel #15
0
 def test_checkout_empty_str(self):
     self.assertEqual(checkout(""), -1)
 def test_checkout(self):
     assert checkout("ZZZ") == 45
 def test_checkout(self):
     assert checkout("STXZ") == 62
Beispiel #18
0
 def test_checkout(self):
     self.assertEqual(checkout("AABC"), 150)
 def test_checkout(self):
     assert checkout(None) == 0
 def test_checkout(self):
     assert checkout("CDFFAECBDEAB") == 300
 def test_checkout(self):
     assert checkout("ACBxA") == -1
 def test_checkout(self):
     assert checkout("RRRQ") == 150
 def test_checkout(self):
     assert checkout("BBCB") == 95
 def test_checkout(self):
     assert checkout("NNNM") == 120
 def test_checkout(self):
     assert checkout("EEEB") == 120
 def test_checkout(self):
     assert checkout("STXYZS") == 90
 def test_checkout(self):
     assert checkout("AAAAA") == 200
 def test_checkout(self):
     assert checkout("SSS") == 45
 def test_checkout(self):
     assert checkout("ABCDEFABCDEF") == 300
 def test_checkout(self):
     assert checkout("SSSZ") == 65