def test_add_nums_returns_sum_and_num_of_additions_performed(self):
        for nums, expected_sum, expected_call_count in [
            #########
            # 20--- # 20000
            #  24-- #  2400
            #   28- #   280
            #    32 #    32
            # ----- #
            #    1  #
            # 22712 #
            #########
            # Number of basic operations:
            # 2, 3+28,   24,   20        => 2, 31, 24, 20
            # 2,    1, 3+24,   20        => 2,  1, 27, 20
            # 2,    1,    7, 2+20        => 2,  1,  7, 22
            # 2,    1,    7,    2, 2     => 2,  1,  7,  2,  2
            (["32", "28", "24", "20"], "22712", 3),

            #########
            # 2---- # 20000
            # 15--- # 15000
            #   3-- #   300
            #   89- #   890
            #     7 #     7
            # ----- #
            #   1   #
            # 36197 #
            #########
            # Number of basic operations:
            # 7, 9, 8+3,   15,   2   => 7, 9, 11, 15, 2
            # 7, 9,   1, 1+15,   2   => 7, 9,  1, 16, 2
            # 7, 9,   1,    6, 1+2   => 7, 9,  1,  6, 3
            (["7", "89", "3", "15", "2"], "36197", 3),

            #########
            #  90-- # 9000
            #   98- #  980
            #    97 #   97
            # ----- #
            #  111  #
            # 10077 #
            #########
            # Number of basic operations:
            # 7, 9+98,    90 => 7, 107,  90
            # 7,    7, 10+90 => 7,   7, 100
            # 7,    7,   100 => 7,   7,   0, 0, 1
            (["97", "98", "90"], "10077", 2)
        ]:
            add_fn = get_operator('+')
            self.assertEquals(add_nums(nums, add_fn), expected_sum)
            self.assertEquals(add_fn.call_count, expected_call_count)
 def test_multiply_works_as_expected(self):
     a, b = 1234, 5678
     add_fn = get_operator('+')
     mul_fn = get_operator('*')
     self.assertEquals(multiply_nums(str(a), str(b), add_fn, mul_fn), str(a * b))
     print(add_fn.call_count, mul_fn.call_count)