@@ -1354,9 +1354,12 @@ def test_callable_p_r(self) -> None:
1354
1354
self .assertTryCastFailure (Callable [[], Any ], _CallableObjectWithOneArg ()) # type: ignore[6] # pyre
1355
1355
self .assertTryCastFailure (Callable [[], Any ], _TypeWithOneArgConstructor ) # type: ignore[6] # pyre
1356
1356
1357
- # NOTE: Cannot introspect constructor for certain built-in types
1358
- # TODO: Define __signature__ for failing internal types
1359
- self .assertTryCastFailure (Callable [[], Any ], bool ) # type: ignore[6] # pyre
1357
+ # NOTE: Cannot introspect constructor for certain built-in types lacking __signature__.
1358
+ # See: https://github.com/davidfstr/trycast/issues/15
1359
+ if sys .version_info >= (3 , 13 ):
1360
+ self .assertTryCastSuccess (Callable [[], Any ], bool ) # type: ignore[6] # pyre
1361
+ else :
1362
+ self .assertTryCastFailure (Callable [[], Any ], bool ) # type: ignore[6] # pyre
1360
1363
self .assertTryCastFailure (Callable [[], Any ], int ) # type: ignore[6] # pyre
1361
1364
self .assertTryCastSuccess (Callable [[], Any ], float ) # type: ignore[6] # pyre
1362
1365
self .assertTryCastSuccess (Callable [[], Any ], complex ) # type: ignore[6] # pyre
@@ -1380,9 +1383,12 @@ def test_callable_p_r(self) -> None:
1380
1383
)
1381
1384
self .assertTryCastFailure (Callable [[Any ], Any ], _TypeWithZeroArgConstructor ) # type: ignore[6] # pyre
1382
1385
1383
- # NOTE: Cannot introspect constructor for certain built-in types
1384
- # TODO: Define __signature__ for failing internal types
1385
- self .assertTryCastFailure (Callable [[Any ], Any ], bool ) # type: ignore[6] # pyre
1386
+ # NOTE: Cannot introspect constructor for certain built-in types lacking __signature__.
1387
+ # See: https://github.com/davidfstr/trycast/issues/15
1388
+ if sys .version_info >= (3 , 13 ):
1389
+ self .assertTryCastSuccess (Callable [[Any ], Any ], bool ) # type: ignore[6] # pyre
1390
+ else :
1391
+ self .assertTryCastFailure (Callable [[Any ], Any ], bool ) # type: ignore[6] # pyre
1386
1392
self .assertTryCastFailure (Callable [[Any ], Any ], int ) # type: ignore[6] # pyre
1387
1393
self .assertTryCastSuccess (Callable [[Any ], Any ], float ) # type: ignore[6] # pyre
1388
1394
self .assertTryCastSuccess (Callable [[Any ], Any ], complex ) # type: ignore[6] # pyre
0 commit comments