def testcalcPriceWithWrongSharedNumber(self):
     try:
         r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                    41.9012)
         r0.calcDetourTime(5)
         r0.calcPrice(5)
         self.fail("Expected exception here.")
     except:
         pass
 def testCalcSatWithWrongDetourTime(self):
     try:
         r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                    41.9012)
         r0.calcDetourTime(1)
         r0.calcSat()
         self.fail("Expected exception here.")
     except:
         pass
    def testCalcSatSuccess(self):
        #without detour time
        r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                   41.9012)
        r0.calcDetourTime(1)
        r0.calcPrice(1)
        r0.calcSat()
        self.assertAlmostEqual(1.592, r0.getSat(), delta=0.01)

        #with detour time
        r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                   41.9012)
        r0.calcDetourTime(2)
        r0.calcPrice(1)
        r0.calcSat()
        self.assertAlmostEqual(1.518, r0.getSat(), delta=0.01)
    def testCalcPriceSuccess(self):
        r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                   41.9012)
        r0.calcDetourTime(5)
        r0.calcPrice(1)
        self.assertAlmostEqual(6.0914, r0.getPrice(), delta=0.01)

        r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                   41.9012)
        r0.calcDetourTime(5)
        r0.calcPrice(2)
        self.assertAlmostEqual(5.901, r0.getPrice(), delta=0.01)

        r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                   41.9012)
        r0.calcDetourTime(5)
        r0.calcPrice(3)
        self.assertAlmostEqual(5.7107, r0.getPrice(), delta=0.01)

        r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                   41.9012)
        r0.calcDetourTime(5)
        r0.calcPrice(4)
        self.assertAlmostEqual(5.52, r0.getPrice(), delta=0.01)
 def testclacDetourTime(self):
     r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                41.9012)
     r0.calcDetourTime(5)
     self.assertEqual(4, r0.getDetourTime())