Fix dict.keys() PY3 compatible
The dict.keys()[0] will raise a TypeError in PY3, as dict.keys() doesn't return a list any more in PY3 but a view of list. Change-Id: I99514d57cb21bf65a59eb36b556248b9494246c7 Closes-Bug: #1583419
This commit is contained in:
parent
44b2182597
commit
df7c0dad5b
|
@ -85,7 +85,7 @@ class TestVNFMonitor(testtools.TestCase):
|
|||
test_boot_wait = 30
|
||||
test_vnfmonitor = VNFMonitor(test_boot_wait)
|
||||
test_vnfmonitor.add_hosting_vnf(test_device_dict)
|
||||
test_device_id = test_vnfmonitor._hosting_vnfs.keys()[0]
|
||||
test_device_id = list(test_vnfmonitor._hosting_vnfs.keys())[0]
|
||||
self.assertEqual(test_device_id, MOCK_DEVICE_ID)
|
||||
|
||||
@mock.patch('tacker.vm.monitor.VNFMonitor.__run__')
|
||||
|
|
|
@ -438,7 +438,7 @@ class XMLDictSerializer(DictSerializer):
|
|||
links = data.pop(link_keys[0], None)
|
||||
has_atom = True
|
||||
root_key = (len(data) == 1 and
|
||||
data.keys()[0] or constants.VIRTUAL_ROOT_KEY)
|
||||
list(data.keys())[0] or constants.VIRTUAL_ROOT_KEY)
|
||||
root_value = data.get(root_key, data)
|
||||
doc = etree.Element("_temp_root")
|
||||
used_prefixes = []
|
||||
|
|
Loading…
Reference in New Issue