MCPcopy Index your code
hub / github.com/pydata/xarray / test_roll

Method test_roll

xarray/tests/test_variable.py:1534–1550  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1532 assert_identical(expected, v.shift(x=1, y=1))
1533
1534 def test_roll(self):
1535 v = Variable("x", [1, 2, 3, 4, 5])
1536
1537 assert_identical(v, v.roll(x=0))
1538 assert v is not v.roll(x=0)
1539
1540 expected = Variable("x", [5, 1, 2, 3, 4])
1541 assert_identical(expected, v.roll(x=1))
1542 assert_identical(expected, v.roll(x=-4))
1543 assert_identical(expected, v.roll(x=6))
1544
1545 expected = Variable("x", [4, 5, 1, 2, 3])
1546 assert_identical(expected, v.roll(x=2))
1547 assert_identical(expected, v.roll(x=-3))
1548
1549 with pytest.raises(ValueError, match=r"dimension"):
1550 v.roll(z=0)
1551
1552 def test_roll_consistency(self):
1553 v = Variable(("x", "y"), np.random.randn(5, 6))

Callers

nothing calls this directly

Calls 3

rollMethod · 0.95
VariableClass · 0.90
assert_identicalFunction · 0.90

Tested by

no test coverage detected