<s> import datetime <EOL> import unittest <EOL> from lymph . utils . event_indexing import EventIndex <EOL> from lymph . core . events import Event <EOL> from mock import patch , Mock <EOL> class TestStore ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> def mockget ( * args , ** kwargs ) : <EOL> return self . mocked <EOL> def mockindex ( * args , ** kwargs ) : <EOL> body = kwargs . get ( '<STR_LIT:body>' , { } ) <EOL> self . mocked = { '<STR_LIT>' : body } <EOL> self . es = Mock ( get = mockget , index = mockindex ) <EOL> def test_stores_event ( self ) : <EOL> index = EventIndex ( self . es , '<STR_LIT>' ) <EOL> event = Event ( '<STR_LIT>' , { '<STR_LIT>' : <NUM_LIT:3> , <EOL> '<STR_LIT:string>' : '<STR_LIT>' , <EOL> '<STR_LIT:float>' : <NUM_LIT> , <EOL> '<STR_LIT>' : { '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT:date>' : datetime . date ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:2> ) , <EOL> '<STR_LIT:bool>' : True , <EOL> '<STR_LIT:list>' : [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] } ) <EOL> with patch ( '<STR_LIT>' , Mock ( hex = '<STR_LIT>' ) ) : <EOL> index . index ( event ) <EOL> es_event = self . es . get ( index = '<STR_LIT>' , id = '<STR_LIT>' ) <EOL> self . assertEquals ( es_event [ '<STR_LIT>' ] [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEquals ( es_event [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <NUM_LIT:3> ) <EOL> self . assertEquals ( es_event [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <NUM_LIT> ) <EOL> self . assertEquals ( es_event [ '<STR_LIT>' ] [ '<STR_LIT>' ] , { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> } ) <EOL> self . assertEquals ( es_event [ '<STR_LIT>' ] [ '<STR_LIT>' ] , datetime . date ( <EOL> <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:2> ) ) <EOL> self . assertEquals ( es_event [ '<STR_LIT>' ] [ '<STR_LIT>' ] , True ) <EOL> self . assertEquals ( es_event [ '<STR_LIT>' ] [ '<STR_LIT>' ] , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> self . assertEquals ( es_event [ '<STR_LIT>' ] [ '<STR_LIT:type>' ] , '<STR_LIT>' ) </s>
