def test_submit_get_results(self): test_dataframe = pd.DataFrame({ "index": np.arange(5), "squared": np.arange(5)**2 }) simple_exp = ATFSampler(test_dataframe) simple_exp.submit(test_dataframe.loc[[0, 2, 3]]) self.assertEqual(simple_exp.job_status, "COMPLETED") simple_exp.monitor() self.assertTrue((simple_exp.get_results()['squared'] == [0, 4, 9]).all())
def test_construction(self): test_dataframe = pd.DataFrame({ "index": np.arange(5), "squared": np.arange(5)**2 }) params = {"dataframe": test_dataframe} simple_exp = ATFSampler(params) self.assertEqual(simple_exp.get_state(), "completed") self.assertTrue( (simple_exp.get_results([0, 2, 3])['squared'] == np.array([0, 4, 9])).all())