Fix test issues

This commit is contained in:
Ben Letham 2020-08-17 18:36:29 -07:00
parent ccde3a498f
commit a88f6458ad
4 changed files with 4 additions and 4 deletions

View file

@ -282,7 +282,7 @@ test_that("copy", {
m1 <- add_regressor(m1, 'binary_feature')
m1 <- fit.prophet(m1, df)
m2 <- prophet:::prophet_copy(m1, cutoff)
changepoints <- changepoints[changepoints <= cutoff]
changepoints <- changepoints[changepoints < cutoff]
expect_equal(prophet:::set_date(changepoints), m2$changepoints)
expect_true('custom' %in% names(m2$seasonalities))
expect_true('binary_feature' %in% names(m2$extra_regressors))

View file

@ -1106,7 +1106,7 @@ class Prophet(object):
history = df[df['y'].notnull()].copy()
if history.shape[0] < 2:
raise ValueError('Dataframe has less than 2 non-NaN rows.')
self.history_dates = pd.to_datetime(df['ds'].unique()).sort_values()
self.history_dates = pd.to_datetime(pd.Series(df['ds'].unique(), name='ds')).sort_values()
history = self.setup_dataframe(history, initialize_scales=True)
self.history = history

View file

@ -350,7 +350,7 @@ class TestDiagnostics(TestCase):
m1.add_regressor('binary_feature')
m1.fit(df)
m2 = diagnostics.prophet_copy(m1, cutoff=cutoff)
changepoints = changepoints[changepoints <= cutoff]
changepoints = changepoints[changepoints < cutoff]
self.assertTrue((changepoints == m2.changepoints).all())
self.assertTrue('custom' in m2.seasonalities)
self.assertTrue('binary_feature' in m2.extra_regressors)

View file

@ -41,7 +41,7 @@ class TestSerialize(TestCase):
# Make sure json doesn't get too large in the future
self.assertTrue(len(model_str) < 200000)
z = json.loads(model_str)
self.assertEqual(z['__fbprophet_version'], '0.6.1.dev0')
self.assertEqual(z['__fbprophet_version'], '0.7')
m2 = model_from_json(model_str)