MCPcopy Index your code
hub / github.com/numpy/numpy / test_simple_int32_inout

Method test_simple_int32_inout

numpy/_core/tests/test_numeric.py:2480–2494  ·  view source on GitHub ↗
(self, casting)

Source from the content-addressed store, hash-verified

2478
2479 @pytest.mark.parametrize("casting", [None, "unsafe"])
2480 def test_simple_int32_inout(self, casting):
2481 # Test native int32 input with double min/max and int32 out.
2482 a = self._generate_int32_data(self.nr, self.nc)
2483 m = np.float64(0)
2484 M = np.float64(2)
2485 ac = np.zeros(a.shape, dtype=np.int32)
2486 act = ac.copy()
2487 if casting is None:
2488 with pytest.raises(TypeError):
2489 self.fastclip(a, m, M, ac, casting=casting)
2490 else:
2491 # explicitly passing "unsafe" will silence warning
2492 self.fastclip(a, m, M, ac, casting=casting)
2493 self.clip(a, m, M, act)
2494 assert_array_strict_equal(ac, act)
2495
2496 def test_simple_int64_out(self):
2497 # Test native int32 input with int32 scalar min/max and int64 out.

Callers

nothing calls this directly

Calls 5

_generate_int32_dataMethod · 0.95
fastclipMethod · 0.95
clipMethod · 0.95
copyMethod · 0.45

Tested by

no test coverage detected