Skip to content

Commit

Permalink
Fixed minor bug on unspecified property through constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Locustv2 committed Aug 3, 2018
1 parent ef98ff3 commit fb26439
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions rebase/core/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def _init_attributes(self):
if isinstance(attribute, str) and attribute:
data = self._get_attr_recurse(
attribute, self._raw_attributes)
data = data if data != attribute else None
elif callable(attribute):
data = attribute()

Expand Down
2 changes: 2 additions & 0 deletions tests/core/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def test_object_basic(self):
'gender': ('gender', lambda x: int(x == 'Male')),
'city': 'location.city',
'country': ('location.country', lambda x: x.upper()),
'occupation': ('occupation', lambda x: x)
}
)
)
Expand All @@ -58,3 +59,4 @@ def test_object_init(self):
self.assertEqual(self.obj.gender, 1)
self.assertEqual(self.obj.city, 'Paris')
self.assertEqual(self.obj.country, 'FRANCE')
self.assertEqual(self.obj.occupation, None)

0 comments on commit fb26439

Please sign in to comment.