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

Method test_inplace_math

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

Source from the content-addressed store, hash-verified

1840 a + c
1841
1842 def test_inplace_math(self):
1843 x = np.arange(5)
1844 v = Variable(["x"], x)
1845 v2 = v
1846 v2 += 1
1847 assert v is v2
1848 # since we provided an ndarray for data, it is also modified in-place
1849 assert source_ndarray(v.values) is x
1850 assert_array_equal(v.values, np.arange(5) + 1)
1851
1852 with pytest.raises(ValueError, match=r"dimensions cannot change"):
1853 v += Variable("y", np.arange(5))
1854
1855 def test_inplace_math_error(self):
1856 x = np.arange(5)

Callers

nothing calls this directly

Calls 3

VariableClass · 0.90
source_ndarrayFunction · 0.90
arangeMethod · 0.80

Tested by

no test coverage detected