Exemple #1
0
 def test_time(self):
     getdf('ping', start_time='2016', end_time='2017')
     self.assertRaises(ValueError,
                       getdf,
                       'ping',
                       start_time='2017',
                       end_time='2010')
        def func():
            if not nodes:
                raise self.Cancelled

            def progress_advance(*_, _counter=0):
                if task.cancelled:
                    raise self.Cancelled
                _counter += 1
                set_progress(_counter / (len(tables) + 1))

            df = getdf(
                tables,
                nodeid=nodes,
                start_time=self.date_from.textFromDateTime(
                    self.date_from.dateTime()),
                end_time=self.date_to.textFromDateTime(
                    self.date_to.dateTime()),
                freq=self.RESOLUTION[self.sample_resolution],
                interpolate=self.INTERPOLATION[self.sample_interpolation],
                callback=progress_advance)
            return df
Exemple #3
0
 def test_interpolate(self):
     n_null = getdf('ping').isnull().sum().sum()
     for method in ('linear', 'ffill', 'bfill', True):
         df = getdf('ping', interpolate=method)
         # Less nulls than if uninterpolated
         self.assertLess(df.isnull().sum().sum(), n_null)
Exemple #4
0
 def test_resample(self):
     df = getdf('ping', resample='1s')
     self.assertEqual(df.index.rule_code, 'M')
Exemple #5
0
 def test_freq(self):
     for freq in _ALLOWED_FREQS:
         getdf('ping', freq=freq)
     self.assertRaises(ValueError, getdf, 'ping', freq='x')
Exemple #6
0
 def test_where(self):
     getdf('ping', where='NodeId = "123"')
     getdf('ping', where=["NodeId = '123'", 'Mode = 1'])
Exemple #7
0
 def test_tables(self):
     getdf('ping')
     getdf('ping,modem')
     getdf('ping modem')
     getdf(['ping', 'modem'])
     getdf('ping', nodeid='404')
     getdf('ping', nodeid=['404', '123'])
     self.assertRaises(ValueError, getdf, 'nonexisting')
     self.assertRaises(ValueError, getdf, 'nonexisting, ping')
Exemple #8
0
 def test_data(self):
     df = getdf('ping')
     self.assertEqual(df.shape[0], N_ROWS)