def test_get_attribute(): person = type_and_instance_attr_eq('Person', 'age', name="Name 4", nickname="Nickname 4", birthday=date(2011, 01, 04), age=1, memory=True) account = type_and_instance('Account', owner=person) bank = type_and_instance('Bank', account=account) universe = type_and_instance('Universe', bank=bank) assert get_attribute(account, "owner__birthday") == date(2011, 01, 04) assert get_attribute(bank, "account__owner__age") == 1 assert get_attribute(bank, "account__owner__name") == "Name 4" assert get_attribute(universe, "bank__account__owner__name") == "Name 4" assert get_attribute(universe, "bank__account__owner") == person
def return_value(self, data): return float(sum([get_attribute(d, self.property_name) for d in data])/len(data))
def return_value(self, data): return min([get_attribute(d, self.property_name) for d in data])