From 06f0cb0dc43f8366f65d1f9db99544c416fc587f Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Mon, 19 Sep 2016 15:45:10 +0000 Subject: [PATCH] updating how p values are tested --- src/py/crankshaft/test/test_clustering_getis.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/py/crankshaft/test/test_clustering_getis.py b/src/py/crankshaft/test/test_clustering_getis.py index 0f3eb3f..2fe0c54 100644 --- a/src/py/crankshaft/test/test_clustering_getis.py +++ b/src/py/crankshaft/test/test_clustering_getis.py @@ -15,8 +15,11 @@ from crankshaft import random_seeds import json class GetisTest(unittest.TestCase): - """Testing class for Getis-Ord's G funtion""" - + """Testing class for Getis-Ord's G funtion + This test replicates the work done in PySAL documentation: + https://pysal.readthedocs.io/en/v1.11.0/users/tutorials/autocorrelation.html#local-g-and-g + """ + def setUp(self): plpy._reset() self.neighbors_data = json.loads(open(fixture_file('neighbors_getis.json')).read()) @@ -34,4 +37,6 @@ class GetisTest(unittest.TestCase): expected = np.array(self.getis_data)[:, 0:2] for ([res_z, res_p], [exp_z, exp_p]) in zip(result, expected): self.assertAlmostEqual(res_z, exp_z, delta=1e-2) - self.assertAlmostEqual(res_p, exp_p, delta=1e-2) + if exp_p <= 0.05: + self.assertTrue(res_p < 0.05) +