def test_bedCheck_aaCheckSameS(self):
     stime = "1a"
     etime = "3a"
     btime = "1a"
     testValue = Babysitter.bedCheck(stime, etime, btime)
     expected = "true"
     self.assertEqual(expected, testValue)
 def test_bedCheck_ppCheckEnd(self):
     stime = "5p"
     etime = "9p"
     btime = "9p"
     testValue = Babysitter.bedCheck(stime, etime, btime)
     expected = "true"
     self.assertEqual(expected, testValue)
 def test_bedCheck_paCheckBefore(self):
     stime = "7p"
     etime = "3a"
     btime = "5p"
     testValue = Babysitter.bedCheck(stime, etime, btime)
     expected = "false"
     self.assertEqual(expected, testValue)
 def test_bedCheck_paCheckBetweena(self):
     stime = "7p"
     etime = "3a"
     btime = "1a"
     testValue = Babysitter.bedCheck(stime, etime, btime)
     expected = "true"
     self.assertEqual(expected, testValue)
 def test_bedCheck_ppCheckMorning(self):
     stime = "7p"
     etime = "9p"
     btime = "1a"
     testValue = Babysitter.bedCheck(stime, etime, btime)
     expected = "false"
     self.assertEqual(expected, testValue)
 def test_bedCheck_aaCheckAfterE(self):
     stime = "1a"
     etime = "3a"
     btime = "4a"
     testValue = Babysitter.bedCheck(stime, etime, btime)
     expected = "false"
     self.assertEqual(expected, testValue)
 def test_BToMPay_ETimeBefore(self):
     etime = 7
     btime = 6
     testValue = Babysitter.BToMPay(btime, etime)
     expected = 8
     self.assertEqual(expected, testValue)
 def test_BToMPay_Greater(self):
     etime = 16
     btime = 16
     testValue = Babysitter.BToMPay(btime, etime)
     expected = 0
     self.assertEqual(expected, testValue)
 def test_SToBPay_BigVal(self):
     stime = 5
     btime = 16
     testValue = Babysitter.SToBPay(stime, btime)
     expected = 132
     self.assertEqual(expected, testValue)
 def test_SToBPay_SmallVal(self):
     stime = 5
     btime = 7
     testValue = Babysitter.SToBPay(stime, btime)
     expected = 24
     self.assertEqual(expected, testValue)
 def test_timeCheck_aaCheckT(self):
     stime = "1a"
     etime = "4a"
     testValue = Babysitter.timeCheck(stime, etime)
     expected = "true"
     self.assertEqual(expected, testValue)
 def test_timeCheck_ppCheckT(self):
     stime = "5p"
     etime = "6p"
     testValue = Babysitter.timeCheck(stime, etime)
     expected = "true"
     self.assertEqual(expected, testValue)
 def test_timeSplit_dayCheck(self):
     timeint = Babysitter.timeSplit("1a")
     expectedInt = 13
     self.assertEqual(expectedInt, timeint)
 def test_inputStartTime_testInput(self):
     #capture results of function
     result = Babysitter.inputStartTime("500a")
     #check for expected output
     expected = "500a"
     self.assertEqual(expected, result)
 def test_MToEPay_Before(self):
     etime = 7
     testValue = Babysitter.MToEPay(etime)
     expected = 0
     self.assertEqual(expected, testValue)
 def test_MToEPay_Sval(self):
     etime = 16
     testValue = Babysitter.MToEPay(etime)
     expected = 64
     self.assertEqual(expected, testValue)
 def test_SToBPay_Same(self):
     stime = 5
     btime = 5
     testValue = Babysitter.SToBPay(stime, btime)
     expected = 0
     self.assertEqual(expected, testValue)
 def test_timeCheck_apCheck(self):
     stime = "1a"
     etime = "6p"
     testValue = Babysitter.timeCheck(stime, etime)
     expected = "false"
     self.assertEqual(expected, testValue)
 def test_timeSplit_nightCheck(self):
     timeint = Babysitter.timeSplit("5p")
     expectedInt = 5
     self.assertEqual(expectedInt, timeint)
 def test_timeCheck_aaCheckAfter(self):
     stime = "4a"
     etime = "2a"
     testValue = Babysitter.timeCheck(stime, etime)
     expected = "false"
     self.assertEqual(expected, testValue)
Exemple #21
0
def calculateBill():
	#creates new window
    bill = Toplevel()
    bill.wm_title("Babysitter Bill")
    
    #Time Information
    l = Label(bill, text="Your bill for the customer:").grid(sticky = "w",row=0, column=0)
    space =Label(bill, text = "" ).grid(row = 2)
    #checks to see that times are valid
    if(Babysitter.timeCheck(stimevar.get(),etimevar.get()) == "true"):
    	time = Label(bill, text = "You babysat from " + stimevar.get() +" - "+ etimevar.get()).grid(sticky = "w",row = 3, column = 0)
    	#checks to see if bed time is valid
    	if(Babysitter.bedCheck(stimevar.get(), etimevar.get(), btimevar.get()) == "true"):
    		bedT = Label(bill, text = "Bedtime was " + btimevar.get()).grid(sticky = "w",row = 4, column = 0)
    		space1 = Label(bill, text = "" ).grid(row = 5)
    		l1 = Label(bill, text ="Pay Breakdown:").grid(sticky = "w",row = 6, column = 0)
    		lr = Label(bill, text ="Pay Rate").grid(sticky = "w",row = 6, column = 1)
    		lp = Label(bill, text ="Pay").grid(sticky = "w",row = 6, column = 2)
    		#split times into integers for math and assign to variables
    		stime = Babysitter.timeSplit(stimevar.get())
    		etime = Babysitter.timeSplit(etimevar.get())
    		btime = Babysitter.timeSplit(btimevar.get())

    		#time breakdown 
    		SToBHours = btime - stime
    		#checks that bedtime is before 12
    		if(btime< 12):
    			#modifies BToMHours if etime is before 12
    			if (etime <12):
    				BToMHours = etime - btime
    			else:
    				BToMHours = 12 - btime
    		else:
    			BToMHours = 0
    		if(etime > 12):
    			MToEHours = etime -12
    		else:
    			MToEHours = 0
    		TotHours = SToBHours + BToMHours + MToEHours

    		#dollar values
    		SToBVal = Babysitter.SToBPay(stime, btime)
    		BToMVal = Babysitter.BToMPay(btime, etime)
    		MToEVal = Babysitter.MToEPay(etime)

    		Total = SToBVal + BToMVal + MToEVal

    		#Start time to Bed time pay label
    		SPay = Label(bill, text = "Start to Bedtime: " + str(SToBHours)+ " hours = ").grid(sticky = "w",row = 7, column = 0)
    		SRate = Label(bill, text ="$12/hr").grid(sticky = "w",row = 7, column = 1)
    		SToBPay = Label(bill, text = "$" + str(SToBVal)).grid(row = 7, column = 2)

    		#Bed Time to midnight pay label
    		MPay = Label(bill, text = "Bedtime to Midnight: " + str(BToMHours)+ " hours = ").grid(sticky = "w",row = 8, column = 0)
    		MRate = Label(bill, text ="$8/hr").grid(sticky = "w",row = 8, column = 1)
    		BToMPay = Label(bill, text = "$" + str(BToMVal)).grid(row = 8, column = 2)

    		#Midnight to Endtime pay Label
    		EPay = Label(bill, text = "Midnight to End: " + str(MToEHours) + " hours = ").grid(sticky = "w",row = 9, column = 0)
    		ERate = Label(bill, text ="$16/hr").grid(sticky = "w",row = 9, column = 1)
    		MToEPay = Label(bill, text = "$" + str(MToEVal)).grid(row = 9, column = 2)
    		
    		#Total
    		TPay = Label(bill, text = "Total Charge: " ).grid(sticky = "w",row = 10, column = 0)
    		TotPay = Label(bill, text = "$" + str(Total)).grid(row = 10, column = 2)


    	else:
    		bedT = Label(bill, text = "Bedtime must be between start and end times").grid(sticky = "w",row = 4, column =0)
    else:
    	time = Label(bill, text = "start time must be before end time").grid(sticky = "w",row = 3, column = 0)