コード例 #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")