def test_restriction(self, dt_obj, nullable, expected_restriction, default_key): """ The correct restriction should be used depending on dt_obj and nullable. """ instance = MgdDatetime(dt_obj=dt_obj, default_key=default_key, nullable=nullable) if instance._restriction != expected_restriction: raise Exception('instance._restriction != expected_restriction')
def test_to_datetime(self, input, output): """ :type input: datetime or str or None :type output: datetime """ instance = MgdDatetime.from_to_datetime() assert instance(input) == output
def test_to_date(self, input, output): """ Test the classmethod `datetime` validates date ISO format properly and handles None. :type input: datetime or str :type output: datetime or None """ instance = MgdDatetime.from_to_date() assert output == instance(input)
def test_null_date(self, input, output): """ Test the classmethod `null_date` validates date ISO format properly and handles None. :type input: date or str or datetime :type output: date or None """ instance = MgdDatetime.null_date() assert instance(input) == output