Exemplo n.º 1
0
 def setUp(self):
     TestBase.setUp(self)
     self.dataset = Dataset.save(self.test_dataset_ids['good_eats.csv'])
     Dataset.build_schema(self.dataset,
             self.test_data['good_eats.csv'].dtypes)
     self.formula = 'rating'
     self.name = 'test'
Exemplo n.º 2
0
 def test_find(self):
     for dataset_name in self.TEST_DATASETS:
         record = Dataset.save(self.test_dataset_ids[dataset_name])
         cursor = Dataset.find(self.test_dataset_ids[dataset_name])
         rows = [x for x in cursor]
         self.assertTrue(isinstance(cursor, Cursor))
         self.assertEqual(record, rows[0])
         self.assertEqual(record, Dataset.find_one(
                     self.test_dataset_ids[dataset_name]))
Exemplo n.º 3
0
 def test_delete(self):
     for dataset_name in self.TEST_DATASETS:
         record = Dataset.save(self.test_dataset_ids[dataset_name])
         records = [x for x in \
                 Dataset.find(self.test_dataset_ids[dataset_name])]
         self.assertNotEqual(records, [])
         Dataset.delete(self.test_dataset_ids[dataset_name])
         records = [x for x in
                 Dataset.find(self.test_dataset_ids[dataset_name])]
         self.assertEqual(records, [])
Exemplo n.º 4
0
 def setUp(self):
     TestBase.setUp(self)
     self.dataset = Dataset.save(self.test_dataset_ids['good_eats.csv'])
     dframe = self.test_data['good_eats.csv']
     Dataset.build_schema(self.dataset, dframe.dtypes)
     Observation.save(dframe, self.dataset)
     self.calculations = [
         'rating',
         'gps',
         'amount + gps_alt',
         'amount - gps_alt',
         'amount + 5',
         'amount - gps_alt + 2.5',
         'amount * gps_alt',
         'amount / gps_alt',
         'amount * gps_alt / 2.5',
         'amount + gps_alt * gps_precision',
         '(amount + gps_alt) * gps_precision',
         'amount = 2',
         '10 < amount',
         '10 < amount + gps_alt',
         'not amount = 2',
         'not(amount = 2)',
         'amount = 2 and 10 < amount',
         'amount = 2 or 10 < amount',
         'not not amount = 2 or 10 < amount',
         'not amount = 2 or 10 < amount',
         '(not amount = 2) or 10 < amount',
         'not(amount = 2 or 10 < amount)',
         'amount ^ 3',
         '(amount + gps_alt) ^ 2 + 100',
         '-amount',
         '-amount < gps_alt - 100',
         'rating in ["delectible"]',
         'risk_factor in ["low_risk"]',
         'amount in ["9.0", "2.0", "20.0"]',
         '(risk_factor in ["low_risk"]) and (amount in ["9.0", "20.0"])',
     ]
     self.places = 5
Exemplo n.º 5
0
 def test_save(self):
     for dataset_name in self.TEST_DATASETS:
         record = Dataset.save(self.test_dataset_ids[dataset_name])
         self.assertTrue(isinstance(record, dict))
         self.assertTrue('_id' in record.keys())
Exemplo n.º 6
0
 def setUp(self):
     TestBase.setUp(self)
     self.dataset = Dataset.save(self.test_dataset_ids['good_eats.csv'])
     Dataset.build_schema(self.dataset,
             self.test_data['good_eats.csv'].dtypes)