def test_classifier_single_class():
 X = [[1, 2], [3, 4]]
 y = [1, 1]
 assert_raise_message(ValueError, 'This solver needs samples of at least 2 classes in the data', LogisticRegression(solver='sag').fit, X, y)

def test_classifier_single_class ( ) : X = [ [ 1 , 2 ] , [ 3 , 4 ] ] y = [ 1 , 1 ] assert_raise_message ( ValueError , 'This solver needs samples of at least 2 classes in the data' , LogisticRegression ( solver = 'sag' ) . fit , X , y )
tests if valueerror is thrown with only one class .