(self, units, error, dtype)
| 2525 | ), |
| 2526 | ) |
| 2527 | def test_univariate_ufunc(self, units, error, dtype): |
| 2528 | array = np.arange(10).astype(dtype) * units |
| 2529 | data_array = xr.DataArray(data=array) |
| 2530 | |
| 2531 | func = function("sin") |
| 2532 | |
| 2533 | if error is not None: |
| 2534 | with pytest.raises(error): |
| 2535 | np.sin(data_array) |
| 2536 | |
| 2537 | return |
| 2538 | |
| 2539 | expected = attach_units( |
| 2540 | func(strip_units(convert_units(data_array, {None: unit_registry.radians}))), |
| 2541 | {None: unit_registry.dimensionless}, |
| 2542 | ) |
| 2543 | actual = func(data_array) |
| 2544 | |
| 2545 | assert_units_equal(expected, actual) |
| 2546 | assert_identical(expected, actual) |
| 2547 | |
| 2548 | @pytest.mark.parametrize( |
| 2549 | "unit,error", |
nothing calls this directly
no test coverage detected