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

Method setup_for_test

xarray/tests/test_duck_array_wrapping.py:114–124  ·  view source on GitHub ↗
(self, request, namespace)

Source from the content-addressed store, hash-verified

112
113class _BaseTest:
114 def setup_for_test(self, request, namespace):
115 self.namespace = namespace
116 self.xp = pytest.importorskip(namespace)
117 self.Array = getattr(self.xp, NAMESPACE_ARRAYS[namespace]["attrs"]["array"])
118 self.constructor = getattr(
119 self.xp, NAMESPACE_ARRAYS[namespace]["attrs"]["constructor"]
120 )
121 xarray_method = request.node.name.split("test_")[1].split("[")[0]
122 if xarray_method in NAMESPACE_ARRAYS[namespace]["xfails"]:
123 reason = NAMESPACE_ARRAYS[namespace]["xfails"][xarray_method]
124 pytest.xfail(f"xfail for {self.namespace}: {reason}")
125
126 def get_test_dataarray(self):
127 data = np.asarray([[1, 2, 3, np.nan, 5]])

Callers 2

setUpMethod · 0.80
setUpMethod · 0.80

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected