Skip to content

Commit a37f3af

Browse files
committed
Adapt MISSING sentinel test to work with unreleased typing_extensions version
Backport of: #13135
1 parent 909259a commit a37f3af

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎tests/test_missing_sentinel.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Annotated, Union
33

44
import pytest
5+
import typing_extensions
56
from annotated_types import Ge
67
from pydantic_core import MISSING, PydanticSerializationUnexpectedValue
78

@@ -53,7 +54,11 @@ class ModelPickle(BaseModel):
5354
f: Union[int, MISSING] = MISSING
5455

5556

56-
@pytest.mark.xfail(reason="PEP 661 sentinels aren't picklable yet in the experimental typing-extensions implementation")
57+
@pytest.mark.xfail(
58+
# Unreleased typing-extensions has the final sentinel implementation with pickle support:
59+
condition=not hasattr(typing_extensions, 'sentinel'),
60+
reason="PEP 661 sentinels aren't picklable yet in the experimental typing-extensions implementation",
61+
)
5762
def test_missing_sentinel_pickle() -> None:
5863
m = ModelPickle()
5964
m_reconstructed = pickle.loads(pickle.dumps(m))

0 commit comments

Comments
 (0)