Пример #1
0
    def test_total_cost_breakout_and_summary(self):
        reunion = Reunion("Lambert Family Reunion")
        activity_1 = Activity("Brunch")
        activity_1.add_participant("Maria", 20)
        activity_1.add_participant("Luther", 40)
        reunion.add_activity(activity_1)

        assert reunion.total_cost, 60

        activity_2 = Activity("Drinks")
        activity_2.add_participant("Maria", 60)
        activity_2.add_participant("Luther", 60)
        activity_2.add_participant("Louis", 0)
        reunion.add_activity(activity_2)
        assert reunion.total_cost, 180
        assert reunion.breakout(), {"Maria": -10, "Luther": -30, "Louis": 40}
        assert type(reunion.summary()), String
Пример #2
0
    def test_breakout(self):
        activity = Activity("Brunch")
        activity.add_participant("Maria", 20)
        activity.add_participant("Luther", 40)

        assert activity.owed(), {'Maria': 10, 'Luther': -10}
Пример #3
0
    def test_returns_amount_owed(self):
        activity = Activity("Brunch")
        activity.add_participant("Maria", 20)
        activity.add_participant("Luther", 40)

        assert activity.owed(), {'Maria': 10, 'Luther': -10}
Пример #4
0
    def test_can_split_costs(self):
        activity = Activity("Brunch")
        activity.add_participant("Maria", 20)
        activity.add_participant("Luther", 40)

        assert activity.split(), 30
Пример #5
0
    def test_calculates_total_cost(self):
        activity = Activity("Brunch")
        activity.add_participant("Maria", 20)
        activity.add_participant("Luther", 40)

        assert activity.total_cost, 60
Пример #6
0
 def test_participants_returns_name_cost(self):
     activity = Activity("Brunch")
     activity.add_participant("Maria", 20)
     activity.add_participant("Luther", 40)
     assert type(activity.participants), hash
     assert activity.participants, {"Maria": 20, "Luther": 40}