(self)
| 1735 | v.set_dims(["z", "x", "y"], shape=(2, 3, 4)) |
| 1736 | |
| 1737 | def test_stack(self): |
| 1738 | v = Variable(["x", "y"], [[0, 1], [2, 3]], {"foo": "bar"}) |
| 1739 | actual = v.stack(z=("x", "y")) |
| 1740 | expected = Variable("z", [0, 1, 2, 3], v.attrs) |
| 1741 | assert_identical(actual, expected) |
| 1742 | |
| 1743 | actual = v.stack(z=("x",)) |
| 1744 | expected = Variable(("y", "z"), v.data.T, v.attrs) |
| 1745 | assert_identical(actual, expected) |
| 1746 | |
| 1747 | actual = v.stack(z=()) |
| 1748 | assert_identical(actual, v) |
| 1749 | |
| 1750 | actual = v.stack(X=("x",), Y=("y",)).transpose("X", "Y") |
| 1751 | expected = Variable(("X", "Y"), v.data, v.attrs) |
| 1752 | assert_identical(actual, expected) |
| 1753 | |
| 1754 | def test_stack_errors(self): |
| 1755 | v = Variable(["x", "y"], [[0, 1], [2, 3]], {"foo": "bar"}) |
nothing calls this directly
no test coverage detected