#NEWLINE# def test_allocate_PF_fail( self ) : #NEWLINE# #INDENT# self . _create_fake_instance ( ) #NEWLINE# with mock . patch . object ( objects . PciDeviceList , 'get_by_parent_address' , side_effect = self . _fake_get_by_parent_address ) : #NEWLINE# #INDENT# self . _create_pci_devices ( ) #NEWLINE# devobj = self . sriov_pf_devices [ 0 ] #NEWLINE# self . sriov_vf_devices [ 0 ] . status = fields . PciDeviceStatus . CLAIMED #NEWLINE# self . assertRaises ( exception . PciDeviceVFInvalidStatus , self . allocate , self . inst )