There was a lot of duplicated code across tests and the setup for the tests was in the geeknn package itself. This PR refactors the two test modules to use pytest.mark.parametrize to reduce duplication and moves the code needed to set up the tests into tests/setup.py.
Currently, we have three tests for our five implemented estimators (Raw, Euclidean, Mahalanobis, MSN, and GNN):
test_image_match: In image mode (using .predict), the predicted image meets a stored "check" image for a large majority of pixels across the first five bands. The number of expected pixel matches is stored as a parameter of each estimator.
test_independent: In feature collection mode (using .predict_fc), the first predicted neighbor does not return itself when a colocation_obj is provided. (A colocation_obj is a dictionary that maps each plot ID used in the model to those plots at the same location. This, by definition includes itself.)
test_dependent: Again, in feature collection model, the first predicted neighbor returns itself when no colocation_obj is provided.
There was a lot of duplicated code across tests and the setup for the tests was in the
geeknn
package itself. This PR refactors the two test modules to usepytest.mark.parametrize
to reduce duplication and moves the code needed to set up the tests intotests/setup.py
.Currently, we have three tests for our five implemented estimators (
Raw
,Euclidean
,Mahalanobis
,MSN
, andGNN
):.predict
), the predicted image meets a stored "check" image for a large majority of pixels across the first five bands. The number of expected pixel matches is stored as a parameter of each estimator..predict_fc
), the first predicted neighbor does not return itself when acolocation_obj
is provided. (Acolocation_obj
is a dictionary that maps each plot ID used in the model to those plots at the same location. This, by definition includes itself.)colocation_obj
is provided.