Esempio n. 1
0
def test_check_X_not_min_samples():
    try:
        check_X(np.ones((5)), min_samples=6, verbose=False)
        assert False
    except ValueError:
        check_X(np.ones((5)), min_samples=5, verbose=False)
        assert True
Esempio n. 2
0
def test_check_X_too_many_dims():
    """check_X accepts at most 2D inputs"""
    try:
        check_X(np.ones((5, 4, 3)))
        assert False
    except ValueError:
        check_X(np.ones((5, 4)))
        assert True
Esempio n. 3
0
def test_check_X_not_int_not_float():
    """X  must be an in or a float"""

    try:
        check_X(['hi'], verbose=False)
        assert False
    except ValueError:
        check_X([4], verbose=False)
        assert True
Esempio n. 4
0
def test_check_X_not_int_not_float():
    """X  must be an in or a float"""
    with pytest.raises(ValueError):
        check_X(['hi'], verbose=False)
Esempio n. 5
0
def test_check_X_not_min_samples():
    with pytest.raises(ValueError):
        check_X(np.ones((5)), min_samples=6, verbose=False)
Esempio n. 6
0
def test_check_X_too_many_dims():
    """check_X accepts at most 2D inputs"""
    with pytest.raises(ValueError):
        check_X(np.ones((5, 4, 3)))