示例#1
0
 def test_converts_invalid_values(self, array):
     x = np.array([
         [np.nan, 0, 2, np.inf],
         [-np.inf, np.nan, 1e-18, 2],
         [np.nan, np.nan, np.nan, np.nan],
         [np.inf, np.inf, np.inf, np.inf],
     ])
     result = nan_to_num(array(x))
     np.testing.assert_equal(assure_array_dense(result), np.nan_to_num(x))
示例#2
0
 def test_preserves_valid_values(self, array):
     x = np.arange(12).reshape((3, 4))
     result = nan_to_num(array(x))
     np.testing.assert_equal(assure_array_dense(result), x)
     np.testing.assert_equal(assure_array_dense(result), np.nan_to_num(x))