コード例 #1
0
def test_reverse_table_TypeError_list():
    with pytest.raises(TypeError):
        algo.reverse_table(8)
コード例 #2
0
def test_max_value_char_list():
    with pytest.raises(TypeError):
        algo.max_value(['1', 'e'])
コード例 #3
0
def test_reverse_table():
    answer = [7, 9, 10, 0, 2, -5, 0, 7, 8, 5, 1]
    assert algo.reverse_table(array) == answer
コード例 #4
0
def test_max_value_TypeError_list():
    with pytest.raises(TypeError):
        algo.max_value(8)
コード例 #5
0
def test_max_value_ValueError_empty_list():
    with pytest.raises(ValueError):
        algo.max_value([])
コード例 #6
0
def test_roi_bboxe_TypeError_list():
    with pytest.raises(TypeError):
        algo.roi_bbox(8)
コード例 #7
0
def test_random_fill_sparse_TypeError_list():
    with pytest.raises(TypeError):
        algo.random_fill_sparse(8, 1)
コード例 #8
0
def test_averrage_divide_by_zero():
    with pytest.raises(ZeroDivisionError):
        algo.average_above_zero([0, 0, 0, 0])
コード例 #9
0
def test_averrage_negative_array_values():
    with pytest.raises(ZeroDivisionError):
        algo.average_above_zero([-2, -3, -8, -7])
コード例 #10
0
def test_averrage_TypeError_list():
    with pytest.raises(TypeError):
        algo.average_above_zero(8)
コード例 #11
0
def test_averrage_valueError_empty_list():
    with pytest.raises(ValueError):
        algo.average_above_zero([])
コード例 #12
0
def test_averrage_above_zero():
    assert algo.average_above_zero(array) == 6.125
コード例 #13
0
def test_random_fill_sparse_TypeError_int():
    with pytest.raises(TypeError):
        algo.random_fill_sparse(array, 'a')
コード例 #14
0
def test_random_fill_sparse_valueError_empty_list():
    with pytest.raises(ValueError):
        algo.random_fill_sparse([], 1)
コード例 #15
0
def test_reverse_table_ValueError_empty_list():
    with pytest.raises(ValueError):
        algo.reverse_table([])
コード例 #16
0
def test_averrage_char_list():
    with pytest.raises(TypeError):
        algo.average_above_zero(['1', 'e'])
コード例 #17
0
def test_roi_bbox():
    img = cv2.imread('img.png', 0)
    answer = np.array([[16, 19], [16, 702], [19, 468], [702, 468]])
    assert (algo.roi_bbox(img) == answer).prod()
コード例 #18
0
def test_max_value():
    assert algo.max_value(array) == (10, 8)
コード例 #19
0
def test_roi_bbox_valueError_empty_list():
    with pytest.raises(ValueError):
        algo.roi_bbox([])
コード例 #20
0
def test_random_fill_sparse():
    fill_value = '/'
    np_array = algo.random_fill_sparse(algo.char_array, 3, fill_value)
    count = len(np.argwhere(np_array == fill_value))
    assert 3 == count