示例#1
0
    def test_numpyarray_fails(self):
        with pytest.raises(ValueError):
            finite(np.asarray((np.inf, np.inf, np.inf, np.inf)))

        with pytest.raises(ValueError):
            finite(np.asarray((-np.inf, np.inf, -np.inf, np.inf)))
示例#2
0
 def test_numpyarray_passes(self):
     finite(np.asarray((1, 2, 3, 4)))
示例#3
0
    def test_list_fails(self):
        with pytest.raises(ValueError):
            finite([np.inf, np.inf, np.inf, np.inf])

        with pytest.raises(ValueError):
            finite([np.inf, -np.inf, np.inf, -np.inf])
示例#4
0
 def test_list_passes(self):
     finite([1, 2, 3, 4])
示例#5
0
    def test_scalar_failses(self):
        with pytest.raises(ValueError):
            finite(np.inf)

        with pytest.raises(ValueError):
            finite(-np.inf)
示例#6
0
 def test_scalar_pass(self):
     finite(4)
     finite(-4)