def changed(self) -> Union[datetime, None]: return FarmObj.timestamp_to_datetime(self.key('changed'))
def birth_date(self) -> Union[datetime, None]: return FarmObj.timestamp_to_datetime(self.key('date'))
def test_farmobj_creation(): farm = Farm() obj = FarmObj(farm, {'name': 'test'}) assert obj.name == 'test'
def archived(self) -> Union[datetime, None]: key = self.key('archived') if key and key != '0': return FarmObj.timestamp_to_datetime(self.key('archived')) else: return None
def date_purchase(self) -> Optional[datetime]: return FarmObj.timestamp_to_datetime(self.key('date_purchase'))
def timestamp(self) -> Optional[datetime]: return FarmObj.timestamp_to_datetime(self.key('timestamp'))
def changed(self) -> Optional[datetime]: return FarmObj.timestamp_to_datetime(self.key('changed'))
def test_farmobj_empty(mock_farm): obj = FarmObj(mock_farm, {}) assert not obj.name assert obj.farm == mock_farm
def test_farmobj_not_empty(mock_farm): obj = FarmObj(mock_farm, { "name": "test", }) assert obj.name == 'test' assert obj.farm == mock_farm
def end_date(self) -> Optional[datetime]: return FarmObj.timestamp_to_datetime( self._keys['date_range']['value2'])
def timestamp(self) -> Optional[datetime]: return FarmObj.timestamp_to_datetime(self.attr('timestamp', int))