(self)
| 406 | assert type(actual) is Variable |
| 407 | |
| 408 | def test_array_interface(self): |
| 409 | x = np.arange(5) |
| 410 | v = self.cls(["x"], x) |
| 411 | assert_array_equal(np.asarray(v), x) |
| 412 | # test patched in methods |
| 413 | assert_array_equal(v.astype(float), x.astype(float)) |
| 414 | # think this is a break, that argsort changes the type |
| 415 | assert_identical(v.argsort(), v.to_base_variable()) |
| 416 | assert_identical(v.clip(2, 3), self.cls("x", x.clip(2, 3)).to_base_variable()) |
| 417 | # test ufuncs |
| 418 | assert_identical(np.sin(v), self.cls(["x"], np.sin(x)).to_base_variable()) |
| 419 | assert isinstance(np.sin(v), Variable) |
| 420 | assert not isinstance(np.sin(v), IndexVariable) |
| 421 | |
| 422 | def example_1d_objects(self): |
| 423 | for data in [ |
nothing calls this directly
no test coverage detected