コード例 #1
0
 def test__calculate_returns_sixteen_for_working_ten_to_midnight_with_bedtime_at_ten(
         self):
     total = babysitter.calculate(10, 10, 12)
     self.assertEquals(total, 16,
                       "Working two hours before midnight should be $16.")
コード例 #2
0
 def test__calculate_returns_124_for_working_five_to_four_with_bedtime_at_six(
         self):
     total = babysitter.calculate(5, 6, 4)
     self.assertEquals(
         total, 124,
         "Working five to four with bedtime at six should be $124.")
コード例 #3
0
 def test__calculate_returns_sixteen_for_working_1_to_2(self):
     total = babysitter.calculate(1, 2, 2)
     self.assertEquals(total, 16, "Working 1am to 2am should be $16.")
コード例 #4
0
 def test__calculate_returns_twelve_for_working_nine_to_ten_with_bedtime_at_ten(
         self):
     total = babysitter.calculate(9, 10, 10)
     self.assertEquals(total, 12,
                       "Working one hour with kid awake should be $12.")
コード例 #5
0
 def test__calculate_returns_sixteen_for_working_1_to_2(self):
     total = babysitter.calculate(1, 2, 2)
     self.assertEquals(total, 16, "Working 1am to 2am should be $16.")
コード例 #6
0
 def test__calculate_returns_sixty_four_for_working_midnight_to_four(self):
     total = babysitter.calculate(12, 12, 4)
     self.assertEquals(total, 64, "Working midnight to 4am should be $64.")
コード例 #7
0
 def test__calculate_returns_sixtyfour_for_working_10_to_two_with_eleven_bedtime(self):
     total = babysitter.calculate(10, 11, 2)
     self.assertEquals(total, 52, "Working ten to two with bedtime at eleven should be $52.")
コード例 #8
0
 def test__calculate_returns_sixtyfour_for_working_10_to_two_with_eleven_bedtime(
         self):
     total = babysitter.calculate(10, 11, 2)
     self.assertEquals(
         total, 52,
         "Working ten to two with bedtime at eleven should be $52.")
コード例 #9
0
 def test__calculate_returns_sixtyfour_for_working_midnight_to_four_with_two_bedtime(self):
     total = babysitter.calculate(12, 2, 4)
     self.assertEquals(total, 64, "Working midnight to four with bedtime at two should be $64.")
コード例 #10
0
 def test__calculate_returns_fiftysix_for_working_10_to_two_with_one_bedtime(self):
     total = babysitter.calculate(10, 1, 2)
     self.assertEquals(total, 56, "Working ten to two with bedtime at one should be $56.")
コード例 #11
0
 def test__calculate_returns_124_for_working_five_to_four_with_bedtime_at_six(self):
     total = babysitter.calculate(5, 6, 4)
     self.assertEquals(total, 124, "Working five to four with bedtime at six should be $124.")
コード例 #12
0
 def test__calculate_returns_sixteen_for_working_ten_to_midnight_with_bedtime_at_ten(self):
     total = babysitter.calculate(10, 10, 12)
     self.assertEquals(total, 16, "Working two hours before midnight should be $16.")
コード例 #13
0
 def test__calculate_returns_twelve_for_working_nine_to_ten_with_bedtime_at_ten(self):
     total = babysitter.calculate(9, 10, 10)
     self.assertEquals(total, 12, "Working one hour with kid awake should be $12.")
コード例 #14
0
 def test__calculate_returns_sixtyfour_for_working_midnight_to_four_with_two_bedtime(
         self):
     total = babysitter.calculate(12, 2, 4)
     self.assertEquals(
         total, 64,
         "Working midnight to four with bedtime at two should be $64.")
コード例 #15
0
 def test__calculate_returns_zero_if_no_time_is_worked(self):
     total = babysitter.calculate(12, 12, 12)
     self.assertEquals(total, 0, "Calculate did not return 0 when no time was worked.")
コード例 #16
0
 def test__calculate_returns_fiftysix_for_working_10_to_two_with_one_bedtime(
         self):
     total = babysitter.calculate(10, 1, 2)
     self.assertEquals(
         total, 56, "Working ten to two with bedtime at one should be $56.")
コード例 #17
0
import babysitter

start_time = input("Please input the start time: ")
bedtime = input("Please input the bed time: ")
end_time = input("Please input the end time: ")

wages = babysitter.calculate(int(start_time), int(bedtime), int(end_time))

print("You earned {} dollars!".format(wages))

コード例 #18
0
 def test__calculate_returns_zero_if_no_time_is_worked(self):
     total = babysitter.calculate(12, 12, 12)
     self.assertEquals(
         total, 0, "Calculate did not return 0 when no time was worked.")
コード例 #19
0
 def test__calculate_returns_sixty_four_for_working_midnight_to_four(self):
     total = babysitter.calculate(12, 12, 4)
     self.assertEquals(total, 64, "Working midnight to 4am should be $64.")