Fix invalid "is not {}" judgement of empty dict
"is not {}" should not be used to judge whether a dict is empty, because it will always return True. So does "is not []". >>> {} is not {} True >>> [] is not [] True Change-Id: I014517d999345e201c3ee96f0634c7975a0cc7bb
This commit is contained in:
parent
7e3f2d794d
commit
395cbb77ef
|
@ -129,8 +129,7 @@ class TestUtils(testtools.TestCase):
|
|||
|
||||
def test_create_vdu_flavor_dict(self):
|
||||
vnfd_dict = self._read_file('vnfd_lcm_user_data.yaml')
|
||||
test_vnfd_dict = {'VNF': {}, 'VDU1':
|
||||
{'ram': 512, 'vcpus': 1, 'disk': 1}, 'CP1': {}}
|
||||
test_vnfd_dict = {'VDU1': {'ram': 512, 'vcpus': 1, 'disk': 1}}
|
||||
vdu_flavor_dict = utils.create_vdu_flavor_dict(vnfd_dict)
|
||||
self.assertEqual(test_vnfd_dict, vdu_flavor_dict)
|
||||
|
||||
|
|
|
@ -840,7 +840,7 @@ def _extract_policy_info(tosca_policies, inst_level_dict,
|
|||
aspect_delta_dict, aspect_id_dict,
|
||||
aspect_vdu_dict, vdu_delta_dict):
|
||||
default_inst_level_id = None
|
||||
if tosca_policies is not []:
|
||||
if tosca_policies:
|
||||
for p in tosca_policies:
|
||||
if p.type == ETSI_SCALING_ASPECT_DELTA:
|
||||
vdu_list = p.targets
|
||||
|
|
|
@ -221,7 +221,7 @@ def create_vdu_flavor_dict(vnfd_dict):
|
|||
vdu_flavor_props = val.get(
|
||||
'capabilities', {}).get(
|
||||
'virtual_compute', {}).get('properties', {})
|
||||
if vdu_flavor_props is not {}:
|
||||
if vdu_flavor_props:
|
||||
flavor_dict = {}
|
||||
for key, val in vdu_flavor_props.items():
|
||||
if key == 'virtual_cpu':
|
||||
|
@ -318,7 +318,7 @@ def create_vdu_flavor_capability_name_dict(vnfd_dict):
|
|||
vdu_flavor_props = val.get(
|
||||
'capabilities', {}).get(
|
||||
'virtual_compute', {}).get('properties', {})
|
||||
if vdu_flavor_props is not {}:
|
||||
if vdu_flavor_props:
|
||||
for key, val in vdu_flavor_props.items():
|
||||
if key == 'requested_additional_capabilities':
|
||||
capability_props = val.get('properties', {})
|
||||
|
@ -347,7 +347,7 @@ def create_sw_image_dict(vnfd_dict):
|
|||
for vdu_name, val in node_templates.items():
|
||||
sw_image_data_props = val.get(
|
||||
'properties', {}).get('sw_image_data', {})
|
||||
if sw_image_data_props is not {}:
|
||||
if sw_image_data_props:
|
||||
if 'name' in sw_image_data_props.keys():
|
||||
sw_image_data[vdu_name] = sw_image_data_props['name']
|
||||
|
||||
|
|
Loading…
Reference in New Issue