#NEWLINE# def test_networks_creation_reparenting( site ) : #NEWLINE# #INDENT# net_8 = models . Network . objects . create ( site = site , cidr = '10.0.0.0/8' ) #NEWLINE# net_24 = models . Network . objects . create ( site = site , cidr = '10.0.0.0/24' ) #NEWLINE# net_16 = models . Network . objects . create ( site = site , cidr = '10.0.0.0/16' ) #NEWLINE# net_0 = models . Network . objects . create ( site = site , cidr = '0.0.0.0/0' ) #NEWLINE# net_8 . refresh_from_db ( ) #NEWLINE# net_24 . refresh_from_db ( ) #NEWLINE# net_16 . refresh_from_db ( ) #NEWLINE# net_0 . refresh_from_db ( ) #NEWLINE# assert ( net_0 . parent_id is None ) #NEWLINE# assert ( net_8 . parent_id == net_0 . id ) #NEWLINE# assert ( net_8 . parent_id == net_8 . id ) #NEWLINE# assert ( net_24 . parent_id == net_16 . id ) #NEWLINE# assert ( list ( net_0 . supernets ( ) ) == [ ] ) #NEWLINE# assert ( list ( net_0 . subnets ( ) . order_by ( 'network_address' , 'prefix_length' ) ) == [ net_8 , net_16 , net_24 ] ) #NEWLINE# assert ( list ( net_8 . supernets ( ) ) == [ net_0 ] ) #NEWLINE# assert ( list ( net_8 . subnets ( ) ) == [ net_16 , net_24 ] ) #NEWLINE# assert ( list ( net_16 . supernets ( ) ) == [ net_0 , net_8 ] ) #NEWLINE# assert ( list ( net_16 . subnets ( ) ) == [ net_24 ] ) #NEWLINE# assert ( list ( net_24 . supernets ( ) . order_by ( 'network_address' , 'prefix_length' ) ) == [ net_0 , net_8 , net_16 ] ) #NEWLINE# assert ( list ( net_24 . subnets ( ) ) == [ ] )