def testDividedFairly(self):
        pay = divide_pay(360.0, {"Alice": 3.0, "Bob": 3.0, "Carol": 3.0, "Joyce": 3.0})
        #check that the right values are returned
        self.assertEqual(pay, {"Alice":90.0, "Bob": 90.0, "Carol": 90.0, "Joyce": 90.0})
        
        pay = divide_pay(360.0, {"Alice": 3.0, "Bob": 3.0, "Carol": 6.0, "Joyce": 0.0})
        # Check that the right values are returned
        self.assertEqual(pay, {"Alice": 90.0, "Bob": 90.0, "Carol": 180.0, "Joyce": 0.0})

        pay = divide_pay(360.0, {"Alice": 0.0, "Bob": 0.0, "Carol": 0.0, "Joyce": 0.0})
        # Check that the right values are returned
        self.assertEqual(pay, {"Alice": 0, "Bob": 0, "Carol": 0, "Joyce": 0.0})
Esempio n. 2
0
 def testDividedFairly_zero_total(self):
     with self.assertRaises(ValueError):
         function_results = divide_pay(360, {
             "Alice": 0,
             "Bob": 0,
             "Carol": 0
         })
Esempio n. 3
0
 def testDividedFairly_amountZero(self):
     function_results = divide_pay(0, {
         "Alice": 0,
         "Bob": 3.0,
         "Carol": 6.0
     })
     self.assertEqual(function_results, {"Alice": 0, "Bob": 0, "Carol": 0})
 def testDividedFairly(self):
     self.answers = {"Alice": 90, "Bob": 90, "Carol": 180}
     self.amount = 360.0
     self.staff_hours = {"Alice": 3.0, "Bob": 3.0, "Carol": 6.0}
         
     result_dict = divide_pay(self.amount,self.staff_hours)
     print "result_dict",result_dict
     
     for staff, result in self.answers.iteritems():
         print staff,result,result_dict[staff]
         self.assertEqual(result,result_dict[staff])
 def test_divided_fairly(self):
     self.assertEqual(
         divide_pay(360.0, {
             "Alice": 3.0,
             "Bob": 3.0,
             "Carol": 6.0
         }), {
             "Alice": 90,
             "Bob": 90,
             "Carol": 180
         })
Esempio n. 6
0
 def testDividedFairly(self):
     function_results = divide_pay(360, {
         "Alice": 3.0,
         "Bob": 3.0,
         "Carol": 6.0
     })
     self.assertEqual(function_results, {
         "Alice": 90.0,
         "Bob": 90.0,
         "Carol": 180.0
     })
 def test_zero_values(self):
     self.assertEqual(
         divide_pay(360.0, {
             "Alice": 3.0,
             "Bob": 3.0,
             "Carol": 0.0
         }), {
             "Alice": 120,
             "Bob": 240,
             "Carol": 0
         })
    def testDividedFairly(self):
        pay = divide_pay(360.0, {
            "Alice": 3.0,
            "Bob": 3.0,
            "Carol": 3.0,
            "Joyce": 3.0
        })
        #check that the right values are returned
        self.assertEqual(pay, {
            "Alice": 90.0,
            "Bob": 90.0,
            "Carol": 90.0,
            "Joyce": 90.0
        })

        pay = divide_pay(360.0, {
            "Alice": 3.0,
            "Bob": 3.0,
            "Carol": 6.0,
            "Joyce": 0.0
        })
        # Check that the right values are returned
        self.assertEqual(pay, {
            "Alice": 90.0,
            "Bob": 90.0,
            "Carol": 180.0,
            "Joyce": 0.0
        })

        pay = divide_pay(360.0, {
            "Alice": 0.0,
            "Bob": 0.0,
            "Carol": 0.0,
            "Joyce": 0.0
        })
        # Check that the right values are returned
        self.assertEqual(pay, {"Alice": 0, "Bob": 0, "Carol": 0, "Joyce": 0.0})
 def test_zero_hours_total(self):
     with self.assertRaises(ValueError):
         pay = divide_pay(360.0, {"Alice": 0.0, "Bob": 0.0, "Carol": 0.0})
 def test_zero_hour_person(self):
     pay = divide_pay(360.0, {"Alice": 3.0, "Bob": 6.0, "Carol": 0.0})
     self.assertEqual(pay, {"Alice": 120.0, "Bob": 240.0, "Carol": 0.0})
Esempio n. 11
0
 def testZeroHoursTotal(self):
     with self.assertRaises(ValueError):
         pay = divide_pay(360.0, {"Alice": 0.0, "Bob": 0.0, "Carol": 0.0})
Esempio n. 12
0
 def testZeroHourPerson(self):
     pay = divide_pay(360.0, {"Alice": 3.0, "Bob": 6.0, "Carol": 0.0})
     self.assertEqual(pay, {"Alice": 120.0, "Bob": 240.0, "Carol": 0.0})
 def test_zero_hour_person(self):
     self.assertEqual(divide_pay(360, {'Alice': 3.0, 'Bob': 6.0, 'Carol': 0.0}), {'Alice': 120.0, 'Bob': 240.0, 'Carol': 0.0})
Esempio n. 14
0
 def testDividedFairly_empty(self):
     with self.assertRaises(ValueError):
         function_results = divide_pay(360, {})
 def test_divided_fairly(self):
     self.assertEqual(divide_pay(360.0, {"Alice": 3.0, "Bob": 3.0, "Carol": 6.0}), {"Alice": 90.0, "Bob": 90.0,
                                                                                    "Carol": 180.0})
Esempio n. 16
0
 def test_no_people(self):
     with self.assertRaises(ValueError):
         pay = divide_pay(360.0, {})
 def test_divided_fairly(self):
     pay = divide_pay(30.0, {"Alice": 3.0, "Bob": 3.0, "Carol": 3.0})
     self.assertEqual(pay, {"Alice": 10.0, "Bob": 10.0, "Carol": 10.0})
 def testDividedFairly(self):
     f = divide_pay(test_project_amount, test_project_hours)
     self.assertEqual(f, test_expected_pay)
 def test_zero_hours(self):
     with self.assertRaises(ValueError):
         pay = divide_pay(360.0, {"Alice": 0.0, "Bob": 0.0, "Carol": 0.0})
 def test_no_people(self):
     with self.assertRaises(ValueError):
         pay = divide_pay(360.0, {})
Esempio n. 21
0
 def testNegativeHours(self):
     with self.assertRaises(ValueError):
         pay = divide_pay(360.0, {"Alice": 3, "Bob": 6, "Carol": -6.0}) 
 def testDividedFairly(self):
   staff_pay = divide_pay(360.0, {"Alice": 3.0, "Bob": 3.0, "Carol": 6.0})
   self.assertEqual(staff_pay["Alice"], 90.0)
   self.assertEqual(staff_pay["Bob"], 90.0)
   self.assertEqual(staff_pay["Carol"], 180.0)
Esempio n. 23
0
 def testDividedPositive(self):
     pay = divide_pay(360,{"Alice":3.0, "Bob": 3.0, "Carol": 6.0})
     self.assertEqual(pay,{"Alice":90.0, "Bob": 90.0, "Carol": 180.0})
 def test_zero_hours_total(self):
     with self.assertRaises(ValueError):
         pay = divide_pay(360.0, {'Alice': 0.0, 'Bob': 0.0, 'Carol': 0.0})
Esempio n. 25
0
 def testZeroHourPerson(self):  # way simpler to just call the function and then assertEqual to the answers.
     pay = divide_pay(360.0, {"Alice": 3.0, "Bob": 6.0, "Carol": 0.0})
     self.assertEqual(pay, {"Alice": 120.0, "Bob": 240.0, "Carol": 0.0}) 
 def test_divided_fairly(self):
     self.assertEqual(divide_pay(360, {'Alice': 3.0, 'Bob': 3.0, 'Carol': 6.0}), {'Alice': 90, 'Bob': 90, 'Carol': 180})