Skip to content

Commit

Permalink
Revert the Python 3.11 exclusion for date isoformat (#32490)
Browse files Browse the repository at this point in the history
The official Python image for 3.11 had a brief period when the
date `20120503` has been an acceptable date, but it is not
accepted as of 3.11.4 release on 5th of July.

This PR reverts  the changes in tests implemented in #27264 to
accomodate for it and brings back the date as error case.
  • Loading branch information
potiuk committed Jul 10, 2023
1 parent 8b4d6a8 commit 60eccf0
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/models/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import pytest

from airflow import PY311
from airflow.decorators import task
from airflow.exceptions import ParamValidationError, RemovedInAirflow3Warning
from airflow.models.param import Param, ParamsDict
Expand Down Expand Up @@ -127,25 +126,20 @@ def test_string_time_format(self):
"date_string",
[
"2021-01-01",
pytest.param(
"20120503",
marks=pytest.mark.skipif(not PY311, reason="Improved fromisoformat() in 3.11."),
),
],
)
def test_string_date_format(self, date_string):
"""Test string date format."""
assert Param(date_string, type="string", format="date").resolve() == date_string

# Note that 20120503 behaved differently in 3.11.3 Official python image. It was validated as a date
# there but it started to fail again in 3.11.4 released on 2023-07-05.
@pytest.mark.parametrize(
"date_string",
[
"01/01/2021",
"21 May 1975",
pytest.param(
"20120503",
marks=pytest.mark.skipif(PY311, reason="Improved fromisoformat() in 3.11."),
),
"20120503",
],
)
def test_string_date_format_error(self, date_string):
Expand Down

0 comments on commit 60eccf0

Please sign in to comment.