diff --git a/src/py/crankshaft/test/test_clustering_getis.py b/src/py/crankshaft/test/test_clustering_getis.py index fc26fc7..c10c8ab 100644 --- a/src/py/crankshaft/test/test_clustering_getis.py +++ b/src/py/crankshaft/test/test_clustering_getis.py @@ -19,20 +19,19 @@ class GetisTest(unittest.TestCase): def setUp(self): plpy._reset() - print(help(cc)) self.neighbors_data = json.loads(open(fixture_file('neighbors_getis.json')).read()) self.getis_data = json.loads(open(fixture_file('getis.json')).read()) def test_getis_ord(self): """Test Getis-Ord's G*""" data = [ { 'id': d['id'], - 'attr1': d['hr8893'], + 'value': d['value'], 'neighbors': d['neighbors'] } for d in self.neighbors_data] plpy._define_result('select', data) random_seeds.set_random_seeds(1234) - result = cc.getis_ord('subquery', 'value', 'knn', 5, 99, 'the_geom', 'cartodb_id') + result = cc.getis_ord('subquery', 'value', 'knn', 5, 999, 'the_geom', 'id') result = [(row[0], row[1]) for row in result] - expected = self.getis_data + expected = np.array(self.getis_data)[:, 0:2] for ([res_z, res_p], [exp_z, exp_p]) in zip(result, expected): - self.assertAlmostEqual(res_val, exp_val) - self.assertEqual(res_quad, exp_quad) + self.assertAlmostEqual(res_z, exp_z, delta=1e-2) + self.assertEqual(res_p, exp_p, delta=1e-2)