Don't overwrite built-in 'id'

This is a follow up for https://review.openstack.org/#/c/399237

'id' is assigned as a builtin function so that we should not use 'id'
for the local variable name.

Change-Id: Ic27460d49e68f6cd50bda1d5b3810e01ccb07a37
This commit is contained in:
Kota Tsuyuzaki
2016-11-18 01:50:11 -08:00
parent 2e7a7347fc
commit 9ea3402569

View File

@@ -292,10 +292,12 @@ class TestRingBuilder(unittest.TestCase):
# >>> bin(int(struct.pack('!f', 1.0/(33)).encode('hex'), 16))
# '0b111100111110000011111000010000'
rb = ring.RingBuilder(8, 3, 1)
for id, (region, zone) in enumerate(11 * [(0, 0), (1, 10), (1, 11)]):
rb.add_dev({'id': id, 'region': region, 'zone': zone, 'weight': 1,
'ip': '127.0.0.1', 'port': 10000 + region * 100 + zone,
'device': 'sda%d' % id})
for dev_id, (region, zone) in enumerate(
11 * [(0, 0), (1, 10), (1, 11)]):
rb.add_dev({'id': dev_id, 'region': region, 'zone': zone,
'weight': 1, 'ip': '127.0.0.1',
'port': 10000 + region * 100 + zone,
'device': 'sda%d' % dev_id})
rb.rebalance()
self.assertEqual(self._partition_counts(rb, 'zone'),
{0: 256, 10: 256, 11: 256})