示例#1
0
    def test_numpyarray_fails(self):
        with pytest.raises(ValueError):
            greater_than(np.asarray(((1, 2), (3, 4))), 5)

        with pytest.raises(ValueError):
            greater_than(np.asarray(((1, 2), (3, 4))),
                         np.asarray(((1, 2), (3, 4))))
示例#2
0
 def test_numpyarray_passes(self):
     greater_than(np.asarray(((1, 2), (3, 4))), 0)
     greater_than(np.asarray(((1, 2), (3, 4))), np.asarray(
         ((0, 1), (2, 3))))
示例#3
0
    def test_list_of_list_fails(self):
        with pytest.raises(ValueError):
            greater_than(((1, 2), (3, 4)), 4)

        with pytest.raises(ValueError):
            greater_than(((1, 2), (3, 4)), ((1, 2), (3, 4)))
示例#4
0
 def test_list_of_list_passes(self):
     greater_than(((1, 2), (3, 4)), 0)
     greater_than(((1, 2), (3, 4)), ((0, 1), (2, 3)))
示例#5
0
    def test_list_fails(self):
        with pytest.raises(ValueError):
            greater_than([1, 2, 3, 4], 4)

        with pytest.raises(ValueError):
            greater_than([1, 2, 3, 4], [1, 2, 3, 4])
示例#6
0
 def test_list_passes(self):
     greater_than([1, 2, 3, 4], 0)
     greater_than([1, 2, 3, 4], [0, 1, 2, 3])
示例#7
0
 def test_scalar_passes(self):
     greater_than(1, 0)
     greater_than(0, -1)