def test_obsolete_result(self): sample_data = { self.start_time - datetime.timedelta(minutes=15): 21.5, self.start_time - datetime.timedelta(minutes=5): 27.5, self.start_time - datetime.timedelta(minutes=15): 33.5 } avg_speed = getSpeed(sample_data, 5) self.assertEqual(avg_speed, "N/A")
def test_obsolete_result(self): sample_data = { self.start_time - datetime.timedelta(minutes=15) : 21.5, self.start_time - datetime.timedelta(minutes=5) : 27.5, self.start_time - datetime.timedelta(minutes=15) : 33.5 } avg_speed = getSpeed(sample_data, 5) self.assertEqual(avg_speed, "N/A")
def test_obsolete_result(self): sample_data = { datetime.datetime.now()- datetime.timedelta(minutes=15) : 21.5, datetime.datetime.now()- datetime.timedelta(minutes=5) : 27.5, datetime.datetime.now()- datetime.timedelta(minutes=15) : 33.5 } avg_speed = getSpeed(sample_data, 5) self.assertTrue(avg_speed == "N/A")
def test_result(self): sample_data = { self.start_time : 10, self.start_time - datetime.timedelta(seconds=3) : 10, self.start_time - datetime.timedelta(microseconds=15) : 20, self.start_time - datetime.timedelta(milliseconds=15) : 20, self.start_time - datetime.timedelta(minutes=15) : 21.5, self.start_time - datetime.timedelta(minutes=5) : 27.5, self.start_time - datetime.timedelta(minutes=15) : 33.5 } avg_speed = getSpeed(sample_data, 5) self.assertEqual(avg_speed, 15)
def test_result(self): sample_data = { self.start_time: 10, self.start_time - datetime.timedelta(seconds=3): 10, self.start_time - datetime.timedelta(microseconds=15): 20, self.start_time - datetime.timedelta(milliseconds=15): 20, self.start_time - datetime.timedelta(minutes=15): 21.5, self.start_time - datetime.timedelta(minutes=5): 27.5, self.start_time - datetime.timedelta(minutes=15): 33.5 } avg_speed = getSpeed(sample_data, 5) self.assertEqual(avg_speed, 15)
def test_result(self): sample_data = { datetime.datetime.now() : 10, datetime.datetime.now()- datetime.timedelta(seconds=3) : 10, datetime.datetime.now()- datetime.timedelta(microseconds=15) : 20, datetime.datetime.now()- datetime.timedelta(milliseconds=15) : 20, datetime.datetime.now()- datetime.timedelta(minutes=15) : 21.5, datetime.datetime.now()- datetime.timedelta(minutes=5) : 27.5, datetime.datetime.now()- datetime.timedelta(minutes=15) : 33.5 } avg_speed = getSpeed(sample_data, 5) self.assertTrue(avg_speed == 15)
def test_empty_result(self): sample_data = {} avg_speed = getSpeed(sample_data, 5) self.assertEqual(avg_speed, "N/A")
def test_empty_result(self): sample_data = {} avg_speed = getSpeed(sample_data, 5) self.assertTrue(avg_speed == "N/A")