(self)
| 2001 | @requires_dask |
| 2002 | @requires_bottleneck |
| 2003 | def test_rank_dask(self): |
| 2004 | # Instead of a single test here, we could parameterize the other tests for both |
| 2005 | # arrays. But this is sufficient. |
| 2006 | v = Variable( |
| 2007 | ["x", "y"], [[30.0, 1.0, np.nan, 20.0, 4.0], [30.0, 1.0, np.nan, 20.0, 4.0]] |
| 2008 | ).chunk(x=1) |
| 2009 | expected = Variable( |
| 2010 | ["x", "y"], [[4.0, 1.0, np.nan, 3.0, 2.0], [4.0, 1.0, np.nan, 3.0, 2.0]] |
| 2011 | ) |
| 2012 | assert_equal(v.rank("y").compute(), expected) |
| 2013 | |
| 2014 | with pytest.raises( |
| 2015 | ValueError, match=r" with dask='parallelized' consists of multiple chunks" |
| 2016 | ): |
| 2017 | v.rank("x") |
| 2018 | |
| 2019 | def test_rank_use_bottleneck(self): |
| 2020 | v = Variable(["x"], [3.0, 1.0, np.nan, 2.0, 4.0]) |
nothing calls this directly
no test coverage detected