@@ -227,12 +227,26 @@ class Joker(TextChoices):
227227# Note: Suppress errors from pyright as the mypy plugin narrows the type of labels if non-lazy.
228228assert_type (VoidChoices .names , list [str ])
229229assert_type (VoidChoices .labels , list [str ]) # pyright: ignore[reportAssertTypeFailure]
230- assert_type (VoidChoices .values , list [Any | None ]) # pyright: ignore[reportAssertTypeFailure]
231- assert_type (VoidChoices .choices , list [tuple [Any | None , str ]]) # pyright: ignore[reportAssertTypeFailure]
230+
231+ assert_type (VoidChoices .values , list [int | None ]) # type: ignore[assert-type] # pyright: ignore[reportAssertTypeFailure]
232+ assert_type (
233+ VoidChoices .values , # pyrefly: ignore[assert-type] # pyright: ignore[reportAssertTypeFailure]
234+ list [Any | None ],
235+ )
236+
237+ assert_type (VoidChoices .choices , list [tuple [int | None , str ]]) # type: ignore[assert-type] # pyright: ignore[reportAssertTypeFailure]
238+ assert_type (
239+ VoidChoices .choices , # pyrefly: ignore[assert-type] # pyright: ignore[reportAssertTypeFailure]
240+ list [tuple [Any | None , str ]],
241+ )
242+
232243assert_type (VoidChoices .ABYSS , Literal [VoidChoices .ABYSS ])
233244assert_type (VoidChoices .ABYSS .name , Literal ["ABYSS" ])
234245assert_type (VoidChoices .ABYSS .label , str ) # pyright: ignore[reportAssertTypeFailure]
235- assert_type (VoidChoices .ABYSS .value , Any )
246+
247+ assert_type (VoidChoices .ABYSS .value , int ) # type: ignore[assert-type] # pyright: ignore[reportAssertTypeFailure]
248+ assert_type (VoidChoices .ABYSS .value , Any ) # pyrefly: ignore[assert-type]
249+
236250assert_type (VoidChoices .ABYSS .do_not_call_in_templates , Literal [True ])
237251assert_type (VoidChoices .__empty__ , str ) # pyright: ignore[reportAssertTypeFailure]
238252
@@ -274,7 +288,10 @@ class Joker(TextChoices):
274288
275289# Assertions for mixing multiple choices types with consistent base types - only `TextChoices`.
276290x1 = (Medal , Gender )
277- assert_type ([member .label for choices in x1 for member in choices ], list [_StrOrPromise ])
291+
292+ assert_type ([member .label for choices in x1 for member in choices ], list [str ]) # type: ignore[assert-type] # pyright: ignore[reportAssertTypeFailure]
293+ assert_type ([member .label for choices in x1 for member in choices ], list [_StrOrPromise ]) # pyrefly: ignore[assert-type]
294+
278295assert_type ([member .value for choices in x1 for member in choices ], list [str ])
279296
280297# Assertions for mixing multiple choices types with different base types - `IntegerChoices` and `TextChoices`.
@@ -284,8 +301,12 @@ class Joker(TextChoices):
284301
285302# Assertions for mixing multiple choices types with consistent base types - custom types.
286303x3 = (Constants , Separator )
287- assert_type ([member .label for choices in x3 for member in choices ], list [_StrOrPromise ])
288- assert_type ([member .value for choices in x3 for member in choices ], list [Any ])
304+
305+ assert_type ([member .label for choices in x3 for member in choices ], list [str ]) # type: ignore[assert-type] # pyright: ignore[reportAssertTypeFailure]
306+ assert_type ([member .label for choices in x3 for member in choices ], list [_StrOrPromise ]) # pyrefly: ignore[assert-type]
307+
308+ assert_type ([member .value for choices in x3 for member in choices ], list [bytes | float ]) # type: ignore[assert-type] # pyright: ignore[reportAssertTypeFailure]
309+ assert_type ([member .value for choices in x3 for member in choices ], list [Any ]) # pyrefly: ignore[assert-type]
289310
290311
291312# Assertions for choices objects defined and aliased in a model.
0 commit comments