Пример #1
0
 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")
Пример #2
0
 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")
Пример #3
0
 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")
Пример #4
0
  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)
Пример #5
0
    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)
Пример #6
0
  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)
Пример #7
0
 def test_empty_result(self):
   sample_data = {}
   avg_speed = getSpeed(sample_data, 5)
   self.assertEqual(avg_speed, "N/A")
Пример #8
0
 def test_empty_result(self):
     sample_data = {}
     avg_speed = getSpeed(sample_data, 5)
     self.assertEqual(avg_speed, "N/A")
Пример #9
0
 def test_empty_result(self):
   sample_data = {}
   avg_speed = getSpeed(sample_data, 5)
   self.assertTrue(avg_speed == "N/A")