예제 #1
0
 def test_add_dataset_for_prediction(self):
     # setup dataset client
     dc = DatasetClient(self.project.hid)
     self.assertNotEqual(dc, None)
     # get datasets, there should be none
     datasets = dc.get_datasets()
     self.assertEqual(len(datasets), 0)
     # add dataset
     my_dataset = dc.add_dataset_if_not_exists(self.X, None)
     self.assertNotEqual(my_dataset, None)
     # get datasets
     datasets = dc.get_datasets()
     self.assertEqual(len(datasets), 1)
     my_dataset_2 = dc.get_dataset(my_dataset.hid)
     self.assertEqual(my_dataset.hid, my_dataset_2.hid)
     self.assertEqual(my_dataset.title, my_dataset_2.title)
예제 #2
0
 def test_add_dataset_for_training(self):
     # setup dataset client
     dc = DatasetClient(self.project.hid)
     self.assertNotEqual(dc, None)
     # get datasets, there should be none
     datasets = dc.get_datasets()
     self.assertEqual(len(datasets), 0)
     # add dataset
     my_dataset = dc.add_dataset_if_not_exists(self.X, self.y)
     self.assertNotEqual(my_dataset, None)
     # get datasets
     datasets = dc.get_datasets()
     self.assertEqual(len(datasets), 1)
     my_dataset_2 = dc.get_dataset(my_dataset.hid)
     self.assertEqual(my_dataset.hid, my_dataset_2.hid)
     self.assertEqual(my_dataset.title, my_dataset_2.title)
     # test __str__ method
     self.assertTrue('id' in str(my_dataset_2))
     self.assertTrue('title' in str(my_dataset_2))
     self.assertTrue('file' in str(my_dataset_2))
예제 #3
0
 def test_get_dataset_for_wrong_hid(self):
     """ Get dataset for wrong hid should return None """
     dc = DatasetClient(self.project.hid)
     dataset = dc.get_dataset('some-wrong-hid')
     self.assertTrue(dataset is None)