示例#1
0
 def test_createts_from_dates(self):
     """Create a ts file from start/end dates and freq."""
     sdate = self.data.index[0]
     edate = self.data.index[-1]
     freq = tsutils.asbestfreq(self.data)
     freq = freq.index.freqstr
     out = tstoolbox.createts(start_date=sdate, end_date=edate, freq=freq).index
     out.name = 'Datetime'
     assert_index_equal(out, self.data.index)
示例#2
0
 def test_createts_from_dates(self):
     """Create a ts file from start/end dates and freq."""
     sdate = self.data.index[0]
     edate = self.data.index[-1]
     freq = tsutils.asbestfreq(self.data)
     freq = freq.index.freqstr
     out = tstoolbox.createts(start_date=sdate, end_date=edate,
                              freq=freq).index
     out.name = "Datetime"
     assert_index_equal(out, self.data.index)
示例#3
0
 def test_exception(self):
     with pytest.raises(ValueError) as e_info:
         _ = tstoolbox.createts()
     assert r"If input_ts is None, then start_date, end_date" in str(
         e_info.value)
示例#4
0
 def test_createts_from_input(self):
     """Create a ts of data_flat.csv."""
     out = tstoolbox.createts(input_ts=self.data).index
     out1 = tstoolbox.read("tests/data_flat.csv").index
     assert_index_equal(out, out1)
示例#5
0
 def test_exception(self):
     with assert_raises_regexp(
             AssertionError,
             r"If input_ts is None, then start_date, end_date"):
         out = tstoolbox.createts()
示例#6
0
 def test_createts_from_input(self):
     ''' Create a ts of data_flat.csv
     '''
     out = tstoolbox.createts(input_ts=self.data).index
     out1 = tstoolbox.read('tests/data_flat.csv').index
     assert_index_equal(out, out1)
示例#7
0
 def test_exception(self):
     with pytest.raises(ValueError) as e_info:
         _ = tstoolbox.createts()
     assert r'If input_ts is None, then start_date, end_date' in str(e_info.value)
示例#8
0
 def test_createts_from_input(self):
     """Create a ts of data_flat.csv."""
     out = tstoolbox.createts(input_ts=self.data).index
     out1 = tstoolbox.read('tests/data_flat.csv').index
     assert_index_equal(out, out1)