Beispiel #1
0
 def changed(self) -> Union[datetime, None]:
     return FarmObj.timestamp_to_datetime(self.key('changed'))
Beispiel #2
0
 def birth_date(self) -> Union[datetime, None]:
     return FarmObj.timestamp_to_datetime(self.key('date'))
Beispiel #3
0
def test_farmobj_creation():
    farm = Farm()
    obj = FarmObj(farm, {'name': 'test'})

    assert obj.name == 'test'
Beispiel #4
0
 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
Beispiel #5
0
 def date_purchase(self) -> Optional[datetime]:
     return FarmObj.timestamp_to_datetime(self.key('date_purchase'))
Beispiel #6
0
 def timestamp(self) -> Optional[datetime]:
     return FarmObj.timestamp_to_datetime(self.key('timestamp'))
Beispiel #7
0
 def changed(self) -> Optional[datetime]:
     return FarmObj.timestamp_to_datetime(self.key('changed'))
Beispiel #8
0
def test_farmobj_empty(mock_farm):
    obj = FarmObj(mock_farm, {})
    assert not obj.name
    assert obj.farm == mock_farm
Beispiel #9
0
def test_farmobj_not_empty(mock_farm):
    obj = FarmObj(mock_farm, {
        "name": "test",
    })
    assert obj.name == 'test'
    assert obj.farm == mock_farm
Beispiel #10
0
 def end_date(self) -> Optional[datetime]:
     return FarmObj.timestamp_to_datetime(
         self._keys['date_range']['value2'])
Beispiel #11
0
 def timestamp(self) -> Optional[datetime]:
     return FarmObj.timestamp_to_datetime(self.attr('timestamp', int))