<s> from numpy . testing import assert_raises <EOL> from blocks . extensions import SimpleExtension <EOL> from blocks . extensions . saveload import Checkpoint <EOL> from blocks . extensions . predicates import OnLogRecord <EOL> def test_parse_args ( ) : <EOL> assert ( SimpleExtension . parse_args ( '<STR_LIT>' , ( '<STR_LIT:a>' , '<STR_LIT:b>' ) ) == <EOL> ( ( '<STR_LIT:a>' , ) , ( '<STR_LIT:b>' , ) ) ) <EOL> assert ( SimpleExtension . parse_args ( '<STR_LIT>' , ( '<STR_LIT:a>' , '<STR_LIT:b>' ) ) == <EOL> ( ( ) , ( '<STR_LIT:a>' , '<STR_LIT:b>' ) ) ) <EOL> def test_add_list_condition ( ) : <EOL> extension_list = Checkpoint ( '<STR_LIT>' ) . add_condition ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> OnLogRecord ( '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , ) ) <EOL> extension_iter = Checkpoint ( '<STR_LIT>' ) <EOL> extension_iter . add_condition ( <EOL> [ '<STR_LIT>' ] , <EOL> OnLogRecord ( '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , ) ) <EOL> extension_iter . add_condition ( <EOL> [ '<STR_LIT>' ] , <EOL> OnLogRecord ( '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , ) ) <EOL> assert len ( extension_list . _conditions ) == len ( extension_iter . _conditions ) <EOL> assert_raises ( ValueError , extension_iter . add_condition , <EOL> callbacks_names = '<STR_LIT>' , <EOL> predicate = OnLogRecord ( '<STR_LIT>' ) , <EOL> arguments = ( '<STR_LIT>' , ) ) </s>
