MCPcopy
hub / github.com/pydata/xarray / test_total_seconds

Method test_total_seconds

xarray/tests/test_accessor_dt.py:107–118  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

105 assert_identical(expected, actual)
106
107 def test_total_seconds(self) -> None:
108 # Subtract a value in the middle of the range to ensure that some values
109 # are negative
110 delta = self.data.time - np.datetime64("2000-01-03")
111 actual = delta.dt.total_seconds()
112 expected = xr.DataArray(
113 np.arange(-48, 52, dtype=np.float64) * 3600,
114 name="total_seconds",
115 coords=[self.data.time],
116 )
117 # This works with assert_identical when pandas is >=1.5.0.
118 assert_allclose(expected, actual)
119
120 @pytest.mark.parametrize(
121 "field, pandas_field",

Callers

nothing calls this directly

Calls 3

assert_allcloseFunction · 0.90
total_secondsMethod · 0.80
arangeMethod · 0.80

Tested by

no test coverage detected