#NEWLINE# def test_1( self ) : #NEWLINE# #INDENT# '\n        Using a single key,\n        ' #NEWLINE# global count #NEWLINE# key = ( 'test' , 'unittest' , '1' ) #NEWLINE# def remove_record( input_tuple ) : #NEWLINE# #INDENT# ( key , _ , _ ) = input_tuple #NEWLINE# self . client . remove ( key ) #NEWLINE# #UNINDENT# self . client . scan ( 'test' , 'unittest' ) . foreach ( remove_record ) #NEWLINE# recIn = { #NEWLINE# #INDENT# 'i' : 1234 , #NEWLINE# 's' : 'abcd' , #NEWLINE# 'b' : bytearray ( 'efgh' , 'utf-8' ) , #NEWLINE# 'l' : [ 1357 , 'aceg' , bytearray ( 'aceg' , 'utf-8' ) , [ 1 , 3 , 5 , 7 ] , { #NEWLINE# #INDENT# 'a' : 1 , #NEWLINE# 'c' : 3 , #NEWLINE# 'e' : 5 , #NEWLINE# 'g' : 7 , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'm' : { #NEWLINE# #INDENT# 'i' : 2468 , #NEWLINE# 's' : 'bdfh' , #NEWLINE# 'l' : [ 2468 , 'bdfh' , bytearray ( 'bdfh' , 'utf-8' ) ] , #NEWLINE# 'm' : { #NEWLINE# #INDENT# 'b' : 2 , #NEWLINE# 'd' : 4 , #NEWLINE# 'f' : 6 , #NEWLINE# 'h' : 8 , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# rc = self . client . put ( key , recIn ) #NEWLINE# self . assertEqual ( rc , 0 , 'wrong return code' ) #NEWLINE# ( key , meta ) = self . client . exists ( key ) #NEWLINE# self . assertTrue ( ( meta is not None ) ) #NEWLINE# count = 0 #NEWLINE# self . client . scan ( 'test' , 'unittest' ) . foreach ( count_records ) #NEWLINE# assert ( count == 1 ) #NEWLINE# self . assertEqual ( count , 1 , 'set should have 1 record' ) #NEWLINE# ( key , meta , recOut ) = self . client . get ( key ) #NEWLINE# self . assertEqual ( recIn , recOut , 'records do not match' ) #NEWLINE# rc = self . client . put ( key , { #NEWLINE# #INDENT# 'hello' : 'world' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( rc , 0 , 'wrong return code' ) #NEWLINE# recIn [ 'hello' ] = 'world' #NEWLINE# ( key , meta , recOut ) = self . client . get ( key ) #NEWLINE# self . assertEqual ( recIn , recOut , 'records do not match' ) #NEWLINE# rc = self . client . remove ( key ) #NEWLINE# self . assertEqual ( rc , 0 , 'wrong return code' ) #NEWLINE# try : #NEWLINE# #INDENT# ( key , meta ) = self . client . exists ( key ) #NEWLINE# '\n            We are making the api backward compatible. In case of\n            RecordNotFound an exception will not be raised.\n            Instead Ok response is returned withe the\n            meta as None. This might change with further releases.\n            ' #NEWLINE# assert ( meta is None ) #NEWLINE# #UNINDENT# except e . RecordNotFound as exception : #NEWLINE# #INDENT# assert ( exception . code == 2 ) #NEWLINE# #UNINDENT# count = 0 #NEWLINE# self . client . scan ( 'test' , 'unittest' ) . foreach ( count_records ) #NEWLINE# self . assertEqual ( count , 0 , 'set should be empty' )