Merge "Use __iter__ method of Attributes class in __repr__ method"
This commit is contained in:
commit
76a1044764
@ -233,7 +233,7 @@ class Attributes(collections.Mapping):
|
|||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return ("Attributes for %s:\n\t" % self._resource_name +
|
return ("Attributes for %s:\n\t" % self._resource_name +
|
||||||
'\n\t'.join(six.itervalues(self._attributes)))
|
'\n\t'.join(six.itervalues(self)))
|
||||||
|
|
||||||
|
|
||||||
def select_from_attribute(attribute_value, path):
|
def select_from_attribute(attribute_value, path):
|
||||||
|
@ -110,6 +110,15 @@ class AttributesTest(common.HeatTestCase):
|
|||||||
test_resolver)
|
test_resolver)
|
||||||
self.assertEqual("value1", attribs['test1'])
|
self.assertEqual("value1", attribs['test1'])
|
||||||
|
|
||||||
|
def test_attributes_representation(self):
|
||||||
|
"""Test that attributes are displayed correct."""
|
||||||
|
test_resolver = lambda x: "value1"
|
||||||
|
attribs = attributes.Attributes('test resource',
|
||||||
|
self.attributes_schema,
|
||||||
|
test_resolver)
|
||||||
|
msg = 'Attributes for test resource:\n\tvalue1\n\tvalue1\n\tvalue1'
|
||||||
|
self.assertEqual(msg, str(attribs))
|
||||||
|
|
||||||
def test_get_attribute_none(self):
|
def test_get_attribute_none(self):
|
||||||
"""Test that we get the attribute values we expect."""
|
"""Test that we get the attribute values we expect."""
|
||||||
test_resolver = lambda x: None
|
test_resolver = lambda x: None
|
||||||
|
Loading…
Reference in New Issue
Block a user