def test_time_to_seconds_no_timezone(self): with pytest.raises(TypeError) as excinfo: primitives.DateTimeField().process_bind_param( "2011-05-24T22:00:02", "postgres") assert "The DateTime 2011-05-24T22:00:02 is invalid" in str( excinfo.value)
def test_not_allow_2400_hrs(self): with pytest.raises(TypeError) as excinfo: primitives.DateTimeField().process_bind_param( "2011-05-24T24:00:00", "postgres") assert "The DateTime 2011-05-24T24:00:00 is invalid" in str( excinfo.value)
def test_code_accept_none_values(self): result = primitives.DateTimeField().process_bind_param( None, "postgres") assert result is None
def test_time_with_timezone(self): result = primitives.DateTimeField().process_bind_param( "2011-05-24T22:00:00+03:14", "postgres") assert result == "2011-05-24T22:00:00+03:14"
def test_only_day_month_and_year(self): result = primitives.DateTimeField().process_bind_param( "2011-05-24", "postgres") assert result == "2011-05-24"