예제 #1
0
파일: test_ceres.py 프로젝트: logsign/ceres
 def test_merge_with_holes(self):
     values = []
     for x in range(0, 10):
         if x % 2 == 0:
             values.append(x)
         else:
             values.append(None)
     new_series = TimeSeriesData(0, 50, 5, values)
     new_series.merge(self.time_series)
     self.assertEqual(list(self.time_series), list(new_series))
예제 #2
0
 def test_merge_with_holes(self):
   values = []
   for x in range(0, 10):
     if x % 2 == 0:
       values.append(x)
     else:
       values.append(None)
   new_series = TimeSeriesData(0, 50, 5, values)
   new_series.merge(self.time_series)
   self.assertEqual(list(self.time_series), list(new_series))
예제 #3
0
파일: test_ceres.py 프로젝트: logsign/ceres
class TimeSeriesDataTest(TestCase):
    def setUp(self):
        self.time_series = TimeSeriesData(0, 50, 5,
                                          [float(x) for x in range(0, 10)])

    def test_timestamps_property(self):
        self.assertEqual(10, len(self.time_series.timestamps))
        self.assertEqual(0, self.time_series.timestamps[0])
        self.assertEqual(45, self.time_series.timestamps[-1])

    def test_iter_values(self):
        values = list(self.time_series)
        self.assertEqual(10, len(values))
        self.assertEqual((0, 0.0), values[0])
        self.assertEqual((45, 9.0), values[-1])

    def test_merge_no_missing(self):
        # merge only has effect if time series has no gaps
        other_series = TimeSeriesData(0, 25, 5,
                                      [float(x * x) for x in range(1, 6)])
        original_values = list(self.time_series)
        self.time_series.merge(other_series)
        self.assertEqual(original_values, list(self.time_series))

    def test_merge_with_empty(self):
        new_series = TimeSeriesData(0, 50, 5, [None] * 10)
        new_series.merge(self.time_series)
        self.assertEqual(list(self.time_series), list(new_series))

    def test_merge_with_holes(self):
        values = []
        for x in range(0, 10):
            if x % 2 == 0:
                values.append(x)
            else:
                values.append(None)
        new_series = TimeSeriesData(0, 50, 5, values)
        new_series.merge(self.time_series)
        self.assertEqual(list(self.time_series), list(new_series))
예제 #4
0
class TimeSeriesDataTest(TestCase):
  def setUp(self):
    self.time_series = TimeSeriesData(0, 50, 5, [float(x) for x in range(0, 10)])

  def test_timestamps_property(self):
    self.assertEqual(10, len(self.time_series.timestamps))
    self.assertEqual(0, self.time_series.timestamps[0])
    self.assertEqual(45, self.time_series.timestamps[-1])

  def test_iter_values(self):
    values = list(self.time_series)
    self.assertEqual(10, len(values))
    self.assertEqual((0, 0.0), values[0])
    self.assertEqual((45, 9.0), values[-1])

  def test_merge_no_missing(self):
    # merge only has effect if time series has no gaps
    other_series = TimeSeriesData(0, 25, 5, [float(x * x) for x in range(1, 6)])
    original_values = list(self.time_series)
    self.time_series.merge(other_series)
    self.assertEqual(original_values, list(self.time_series))

  def test_merge_with_empty(self):
    new_series = TimeSeriesData(0, 50, 5, [None] * 10)
    new_series.merge(self.time_series)
    self.assertEqual(list(self.time_series), list(new_series))

  def test_merge_with_holes(self):
    values = []
    for x in range(0, 10):
      if x % 2 == 0:
        values.append(x)
      else:
        values.append(None)
    new_series = TimeSeriesData(0, 50, 5, values)
    new_series.merge(self.time_series)
    self.assertEqual(list(self.time_series), list(new_series))
예제 #5
0
파일: test_ceres.py 프로젝트: logsign/ceres
 def test_merge_with_empty(self):
     new_series = TimeSeriesData(0, 50, 5, [None] * 10)
     new_series.merge(self.time_series)
     self.assertEqual(list(self.time_series), list(new_series))
예제 #6
0
 def test_merge_with_empty(self):
   new_series = TimeSeriesData(0, 50, 5, [None] * 10)
   new_series.merge(self.time_series)
   self.assertEqual(list(self.time_series), list(new_series))