(self, Var)
| 3099 | |
| 3100 | @requires_pint |
| 3101 | def test_from_pint(self, Var): |
| 3102 | import pint |
| 3103 | |
| 3104 | arr = np.array([1, 2, 3]) |
| 3105 | |
| 3106 | # IndexVariable strips the unit |
| 3107 | with warnings.catch_warnings(): |
| 3108 | warnings.simplefilter("ignore", category=pint.UnitStrippedWarning) |
| 3109 | v = Var("x", pint.Quantity(arr, units="m")) |
| 3110 | |
| 3111 | assert_identical(v.as_numpy(), Var("x", arr)) |
| 3112 | np.testing.assert_equal(v.to_numpy(), arr) |
| 3113 | |
| 3114 | @requires_sparse |
| 3115 | def test_from_sparse(self, Var): |
nothing calls this directly
no test coverage detected