def legislative_term(self, libobject: JSON, term: LegislativeTerm) -> Optional[LegislativeTerm]: if not libobject.get("startDate") or not libobject.get("endDate"): logger.error("Term has no start or end date - skipping") return None term.start = self.utils.parse_date(libobject.get("startDate")) term.end = self.utils.parse_date(libobject.get("endDate")) return term
def test_legislative_term(self): term = LegislativeTerm() data = self.api_data["https://oparl.example.org/term/21"] self.converter.legislative_term(data, term) self.assertEqual(term.start, date(year=2010, month=12, day=3)) self.assertEqual(term.end, date(year=2013, month=12, day=3))