def test_compare_pure(self, complete, partial_mask): assert np.allclose(euclidean_pdist(complete, partial_mask), pure_euclidean_pdist(complete, partial_mask))
def test_missing(self, miss_all): result = euclidean_pdist(miss_all, np.isnan(miss_all)) assert result.shape == (pytest.helpers.number_pairs(miss_all.shape[0]),) assert np.isnan(result).all()
def test_compare_scipy(self, complete): assert np.allclose(euclidean_pdist(complete, np.isnan(complete)), pdist(complete, metric="euclidean"))
def test_wrong_shape(self, dimension): with pytest.raises(ValueError): euclidean_pdist(dimension, np.isnan(dimension))
def test_mask_shape(self, complete): with pytest.raises(ValueError): euclidean_pdist(complete, np.isnan(complete[:complete.shape[0] - 10, :complete.shape[1] - 10]))
def test_missing(self, miss_all): result = euclidean_pdist(miss_all, np.isnan(miss_all)) assert result.shape == (pytest.helpers.number_pairs( miss_all.shape[0]), ) assert np.isnan(result).all()
def test_mask_shape(self, complete): with pytest.raises(ValueError): euclidean_pdist( complete, np.isnan(complete[:complete.shape[0] - 10, :complete.shape[1] - 10]))