#NEWLINE# def test_consume_VF_requests( self ) : #NEWLINE# #INDENT# with mock . patch . object ( objects . PciDevice , 'get_by_dev_addr' , side_effect = self . _fake_pci_device_get_by_addr ) : #NEWLINE# #INDENT# self . _create_pci_devices ( ) #NEWLINE# pci_requests = [ objects . InstancePCIRequest ( count = 2 , spec = [ { #NEWLINE# #INDENT# 'product_id' : '1515' , #NEWLINE# #UNINDENT# } ] ) ] #NEWLINE# devs = self . pci_stats . consume_requests ( pci_requests ) #NEWLINE# self . assertEqual ( 2 , len ( devs ) ) #NEWLINE# self . assertEqual ( set ( [ '1515' ] ) , set ( [ dev . product_id for dev in devs ] ) ) #NEWLINE# free_devs = self . pci_stats . get_free_devs ( ) #NEWLINE# for dev in devs : #NEWLINE# #INDENT# self . assertTrue ( all ( ( ( devs . parent_addr != free_dev . address ) for free_dev in free_devs ) ) )