<s> from pebl . test import testfile <EOL> from pebl import data , result <EOL> from pebl . learner import greedy <EOL> class TestGreedyLearner : <EOL> def setUp ( self ) : <EOL> self . data = data . fromfile ( testfile ( '<STR_LIT>' ) ) <EOL> self . data . discretize ( ) <EOL> def test_max_iterations ( self ) : <EOL> g = greedy . GreedyLearner ( self . data , max_iterations = <NUM_LIT:100> ) <EOL> g . run ( ) <EOL> assert g . stats . iterations == <NUM_LIT:100> <EOL> def test_max_time ( self ) : <EOL> g = greedy . GreedyLearner ( self . data , max_time = <NUM_LIT:2> ) <EOL> g . run ( ) <EOL> runtime = g . stats . runtime <EOL> assert runtime >= <NUM_LIT:2> and runtime < <NUM_LIT:3> <EOL> def test_max_unimproved_iterations ( self ) : <EOL> g1 = greedy . GreedyLearner ( self . data , max_unimproved_iterations = <NUM_LIT:1> ) <EOL> g1 . run ( ) <EOL> g2 = greedy . GreedyLearner ( self . data , max_unimproved_iterations = <NUM_LIT:100> ) <EOL> g2 . run ( ) <EOL> assert g1 . stats . restarts > g2 . stats . restarts </s>
