def test_aggregator_2d(agg_func): """ Test Aggregator.aggregate_2d function. """ agg_func_name, npy_func = agg_func agg = Aggregator(agg_func_name) data = np.random.rand(100, 10) np.testing.assert_allclose(agg.aggregate_2d(data), npy_func(data, axis=0))
def test_aggregator_2d(agg_func, axis): """Test Aggregator.aggregate_2d function.""" agg_func_name, npy_func = agg_func agg = Aggregator(agg_func_name) data = np.random.rand(100, 10) result = agg.aggregate_2d(data, axis=axis) assert len(result) == data.shape[1 - axis] np.testing.assert_allclose(result, npy_func(data, axis=axis))