#NEWLINE# def test_stats8( self ) : #NEWLINE# #INDENT# ' Make sure stats are correct\n        ' #NEWLINE# th = TestHelper ( ) #NEWLINE# p1 = th . add_prefix ( '1.0.0.0/24' , 'reservation' , 'test' ) #NEWLINE# p2 = th . add_prefix ( '1.0.0.0/32' , 'reservation' , 'test' ) #NEWLINE# res = Prefix . smart_search ( '1.0.0.0/24' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( 256 , res [ 'result' ] [ 0 ] . total_addresses ) #NEWLINE# self . assertEqual ( 1 , res [ 'result' ] [ 0 ] . used_addresses ) #NEWLINE# self . assertEqual ( 255 , res [ 'result' ] [ 0 ] . free_addresses ) #NEWLINE# p3 = th . add_prefix ( '1.0.0.2/31' , 'reservation' , 'test' ) #NEWLINE# res = Prefix . smart_search ( '1.0.0.0/24' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( 256 , res [ 'result' ] [ 0 ] . total_addresses ) #NEWLINE# self . assertEqual ( 3 , res [ 'result' ] [ 0 ] . used_addresses ) #NEWLINE# self . assertEqual ( 253 , res [ 'result' ] [ 0 ] . free_addresses ) #NEWLINE# p3 . prefix = '1.0.0.2/32' #NEWLINE# p3 . save ( ) #NEWLINE# res = Prefix . smart_search ( '1.0.0.0/24' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( 256 , res [ 'result' ] [ 0 ] . total_addresses ) #NEWLINE# self . assertEqual ( 2 , p2 [ 'result' ] [ 0 ] . used_addresses ) #NEWLINE# self . assertEqual ( 254 , res [ 'result' ] [ 0 ] . free_addresses )