#NEWLINE# def testEventify( self ) : #NEWLINE# #INDENT# '\n        Test eventify function\n        ' #NEWLINE# console . terse ( '{0}\n' . format ( self . testEventify . __doc__ ) ) #NEWLINE# console . reinit ( verbosity = console . Wordage . profuse ) #NEWLINE# dt = datetime . datetime . utcnow ( ) #NEWLINE# stamp = dt . isoformat ( ) #NEWLINE# event = eventing . eventify ( 'hello' ) #NEWLINE# self . assertEqual ( event [ 'tag' ] , 'hello' ) #NEWLINE# self . assertEqual ( event [ 'data' ] , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# tdt = datetime . datetime . strptime ( event [ 'stamp' ] , '%Y-%m-%dT%H:%M:%S.%f' ) #NEWLINE# self . assertGreater ( tdt , dt ) #NEWLINE# event = eventing . eventify ( tag = eventing . tagify ( head = 'exchange' , tail = 'started' ) , stamp = stamp ) #NEWLINE# self . assertEqual ( event [ 'tag' ] , 'exchange.started' ) #NEWLINE# self . assertEqual ( event [ 'stamp' ] , stamp ) #NEWLINE# event = eventing . eventify ( tag = eventing . tagify ( tail = 'started' , head = 'exchange' ) , stamp = stamp , data = odict ( name = 'John' ) ) #NEWLINE# self . assertEqual ( event [ 'tag' ] , 'exchange.started' ) #NEWLINE# self . assertEqual ( event [ 'stamp' ] , stamp ) #NEWLINE# self . assertEqual ( event [ 'data' ] , { #NEWLINE# #INDENT# 'name' : 'John' , #NEWLINE# #UNINDENT# } ) #NEWLINE# stamp = '2015-08-10T19:26:47.194736' #NEWLINE# event = eventing . eventify ( tag = 'process.started' , stamp = stamp , data = { #NEWLINE# #INDENT# 'name' : 'Jill' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( event , { #NEWLINE# #INDENT# 'tag' : 'process.started' , #NEWLINE# 'stamp' : '2015-08-10T19:26:47.194736' , #NEWLINE# 'data' : { #NEWLINE# #INDENT# 'name' : 'Jill' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# event = eventing . eventify ( tag = 'with uid' , stamp = stamp , uid = 'abcde' ) #NEWLINE# self . assertEqual ( event , { #NEWLINE# #INDENT# 'data' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'stamp' : '2015-08-10T19:26:47.194736' , #NEWLINE# 'tag' : 'with uid' , #NEWLINE# 'uid' : 'abcde' , #NEWLINE# #UNINDENT# } ) #NEWLINE# console . reinit ( verbosity = console . Wordage . concise )