提交 40f6d7db authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Account for warnings in test_tensor_values_eq_approx

上级 b97aebb4
...@@ -95,15 +95,18 @@ def test_filter_memmap(): ...@@ -95,15 +95,18 @@ def test_filter_memmap():
def test_tensor_values_eq_approx(): def test_tensor_values_eq_approx():
# test, inf, -inf and nan equal themself # test, inf, -inf and nan equal themselves
a = np.asarray([-np.inf, -1, 0, 1, np.inf, np.nan]) a = np.asarray([-np.inf, -1, 0, 1, np.inf, np.nan])
assert TensorType.values_eq_approx(a, a) with pytest.warns(RuntimeWarning):
assert TensorType.values_eq_approx(a, a)
# test inf, -inf don't equal themself # test inf, -inf don't equal themselves
b = np.asarray([np.inf, -1, 0, 1, np.inf, np.nan]) b = np.asarray([np.inf, -1, 0, 1, np.inf, np.nan])
assert not TensorType.values_eq_approx(a, b) with pytest.warns(RuntimeWarning):
assert not TensorType.values_eq_approx(a, b)
b = np.asarray([-np.inf, -1, 0, 1, -np.inf, np.nan]) b = np.asarray([-np.inf, -1, 0, 1, -np.inf, np.nan])
assert not TensorType.values_eq_approx(a, b) with pytest.warns(RuntimeWarning):
assert not TensorType.values_eq_approx(a, b)
# test allow_remove_inf # test allow_remove_inf
b = np.asarray([np.inf, -1, 0, 1, 5, np.nan]) b = np.asarray([np.inf, -1, 0, 1, 5, np.nan])
...@@ -115,4 +118,5 @@ def test_tensor_values_eq_approx(): ...@@ -115,4 +118,5 @@ def test_tensor_values_eq_approx():
b = np.asarray([np.inf, -1, 0, 1, 5, np.nan]) b = np.asarray([np.inf, -1, 0, 1, 5, np.nan])
assert not TensorType.values_eq_approx(a, b, allow_remove_nan=False) assert not TensorType.values_eq_approx(a, b, allow_remove_nan=False)
b = np.asarray([-np.inf, -1, 0, 1, np.inf, 6]) b = np.asarray([-np.inf, -1, 0, 1, np.inf, 6])
assert not TensorType.values_eq_approx(a, b, allow_remove_nan=False) with pytest.warns(RuntimeWarning):
assert not TensorType.values_eq_approx(a, b, allow_remove_nan=False)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论