def _transform(self): if not block_device.new_format_is_swap(self._bdm_obj): raise _InvalidType self.update({ 'device_name': self._bdm_obj.device_name, 'swap_size': self._bdm_obj.volume_size or 0, 'disk_bus': self._bdm_obj.disk_bus })
def test_new_format_is_swap(self): expected_results = [True, False, False, False, False] for expected, bdm in zip(expected_results, self.new_mapping): res = block_device.new_format_is_swap(bdm) self.assertEqual(expected, res)