]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Adds tests for attributes.is_attr_set
authorZhongyue Luo <zhongyue.nah@intel.com>
Mon, 12 Nov 2012 03:49:42 +0000 (11:49 +0800)
committerZhongyue Luo <zhongyue.nah@intel.com>
Mon, 12 Nov 2012 05:09:41 +0000 (13:09 +0800)
commit4df4f7eec84eff7bdaebc651640eb7e95a3b1b77
treea77217e975d7c0ba90cd176444f47de2c9e666f5
parent30b64f0b901cdf0f3121f4ddb5b96e236f4155b1
Adds tests for attributes.is_attr_set

ATTR_NOT_SPECIFIED and None are singleton objects

When conducting "is in" against a list of objects, they are compared using
unequal unless they are the same object.
http://docs.python.org/2/reference/expressions.html#in

According to PEP8, they should be compared by their id not value
Therefore the is_attr_set logic has changed to:
    return not (attribute is None or attribute is ATTR_NOT_SPECIFIED)

Wrote unittests for is_attr_set

Change-Id: I2ebdd29564e5627b9e33b13a744948e8c9c0b9ce
quantum/api/v2/attributes.py
quantum/tests/unit/test_attributes.py