<s> import unittest <EOL> from pikos . recorders . list_recorder import ListRecorder <EOL> from pikos . tests . compat import TestCase <EOL> from pikos . tests . dummy_record import DummyRecord <EOL> class TestListRecorder ( TestCase ) : <EOL> def test_prepare ( self ) : <EOL> output = [ ] <EOL> recorder = ListRecorder ( ) <EOL> recorder . prepare ( DummyRecord ) <EOL> self . assertSequenceEqual ( recorder . records , output ) <EOL> recorder . prepare ( DummyRecord ) <EOL> def test_finalize ( self ) : <EOL> output = [ ] <EOL> recorder = ListRecorder ( ) <EOL> recorder . prepare ( DummyRecord ) <EOL> for x in range ( <NUM_LIT:10> ) : <EOL> recorder . finalize ( ) <EOL> self . assertSequenceEqual ( recorder . records , output ) <EOL> def test_record ( self ) : <EOL> record = DummyRecord ( <NUM_LIT:5> , '<STR_LIT>' , '<STR_LIT>' ) <EOL> output = [ ( <NUM_LIT:5> , '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> recorder = ListRecorder ( ) <EOL> recorder . prepare ( DummyRecord ) <EOL> recorder . record ( record ) <EOL> self . assertSequenceEqual ( recorder . records , output ) <EOL> def test_filter ( self ) : <EOL> records = [ <EOL> DummyRecord ( <NUM_LIT:5> , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> DummyRecord ( <NUM_LIT:12> , '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> output = [ ( <NUM_LIT:12> , '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> def not_pikos ( values ) : <EOL> return not ( '<STR_LIT>' in values ) <EOL> recorder = ListRecorder ( filter_ = not_pikos ) <EOL> recorder . prepare ( DummyRecord ) <EOL> for record in records : <EOL> recorder . record ( record ) <EOL> self . assertSequenceEqual ( recorder . records , output ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
