Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.

Commit fb26439

Browse files
committed
Fixed minor bug on unspecified property through constructor
1 parent ef98ff3 commit fb26439

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

rebase/core/object.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def _init_attributes(self):
157157
if isinstance(attribute, str) and attribute:
158158
data = self._get_attr_recurse(
159159
attribute, self._raw_attributes)
160+
data = data if data != attribute else None
160161
elif callable(attribute):
161162
data = attribute()
162163

tests/core/test_object.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def test_object_basic(self):
4747
'gender': ('gender', lambda x: int(x == 'Male')),
4848
'city': 'location.city',
4949
'country': ('location.country', lambda x: x.upper()),
50+
'occupation': ('occupation', lambda x: x)
5051
}
5152
)
5253
)
@@ -58,3 +59,4 @@ def test_object_init(self):
5859
self.assertEqual(self.obj.gender, 1)
5960
self.assertEqual(self.obj.city, 'Paris')
6061
self.assertEqual(self.obj.country, 'FRANCE')
62+
self.assertEqual(self.obj.occupation, None)

0 commit comments

Comments
 (0)