コード例 #1
0
 def testCalcSatWithWrongPrice(self):
     try:
         r0 = Rider("R0", 0, 8, 24, 7.75, 20, -87.6333, 41.8996, -87.6764,
                    41.9012)
         r0.calcSat()
         self.fail("Expected exception here.")
     except:
         pass
コード例 #2
0
    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)