#NEWLINE# @ pytest . yield_fixture #NEWLINE# def date_data( db ) : #NEWLINE# #INDENT# n = 3 #NEWLINE# d = { #NEWLINE# #INDENT# 'name' : [ 'Alice' , 'Bob' , 'Joe' ] , #NEWLINE# 'when' : [ datetime ( 2010 , 1 , 1 , i ) for i in [ 1 , 2 , 3 ] ] , #NEWLINE# 'amount' : [ 100 , 200 , 300 ] , #NEWLINE# 'id' : [ 1 , 2 , 3 ] , #NEWLINE# #UNINDENT# } #NEWLINE# data = [ dict ( zip ( d . keys ( ) , [ d [ k ] [ i ] for k in d . keys ( ) ] ) ) for i in range ( n ) ] #NEWLINE# coll = into ( db . date_data , data ) #NEWLINE# try : #NEWLINE# #INDENT# ( yield coll ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# coll . drop ( )