def test_rus_bad_ratio():
 ratio = (-1.0)
 rus = RandomUnderSampler(ratio=ratio)
 assert_raises(ValueError, rus.fit, X, Y)
 ratio = 100.0
 rus = RandomUnderSampler(ratio=ratio)
 assert_raises(ValueError, rus.fit, X, Y)
 ratio = 'rnd'
 rus = RandomUnderSampler(ratio=ratio)
 assert_raises(ValueError, rus.fit, X, Y)
 ratio = [0.5, 0.5]
 rus = RandomUnderSampler(ratio=ratio)
 assert_raises(ValueError, rus.fit, X, Y)

def test_rus_bad_ratio ( ) : ratio = ( - 1.0 ) rus = RandomUnderSampler ( ratio = ratio ) assert_raises ( ValueError , rus . fit , X , Y ) ratio = 100.0 rus = RandomUnderSampler ( ratio = ratio ) assert_raises ( ValueError , rus . fit , X , Y ) ratio = 'rnd' rus = RandomUnderSampler ( ratio = ratio ) assert_raises ( ValueError , rus . fit , X , Y ) ratio = [ 0.5 , 0.5 ] rus = RandomUnderSampler ( ratio = ratio ) assert_raises ( ValueError , rus . fit , X , Y )
test either if an error is raised with a wrong decimal value for the ratio .