A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pydata/xarray/commit/9d6269de9fec4c66aeade2fdf9829c6e066a6eac below:

Tests for aggregate methods using the array API · pydata/xarray@9d6269d · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+8

-6

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+8

-6

lines changed Original file line number Diff line number Diff line change

@@ -39,18 +39,20 @@ def test_arithmetic(arrays: tuple[xr.DataArray, xr.DataArray]) -> None:

39 39

assert_equal(actual, expected)

40 40 41 41 42 -

def test_aggregation(arrays: tuple[xr.DataArray, xr.DataArray]) -> None:

42 +

@pytest.mark.parametrize("method", ["max", "min", "mean", "prod", "sum", "std", "var"])

43 +

def test_aggregation(method: str, arrays: tuple[xr.DataArray, xr.DataArray]) -> None:

43 44

np_arr, xp_arr = arrays

44 -

expected = np_arr.sum()

45 -

actual = xp_arr.sum()

45 +

expected = getattr(np_arr, method)()

46 +

actual = getattr(xp_arr, method)()

46 47

assert isinstance(actual.data, Array)

47 48

assert_equal(actual, expected)

48 49 49 50 50 -

def test_aggregation_skipna(arrays) -> None:

51 +

@pytest.mark.parametrize("method", ["max", "min", "mean", "prod", "sum", "std", "var"])

52 +

def test_aggregation_skipna(method: str, arrays: tuple[xr.DataArray, xr.DataArray]) -> None:

51 53

np_arr, xp_arr = arrays

52 -

expected = np_arr.sum(skipna=False)

53 -

actual = xp_arr.sum(skipna=False)

54 +

expected = getattr(np_arr, method)(skipna=False)

55 +

actual = getattr(xp_arr, method)(skipna=False)

54 56

assert isinstance(actual.data, Array)

55 57

assert_equal(actual, expected)

56 58

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4