@@ -1387,3 +1387,109 @@ def test_get_varargs_negative_start_raises(self) -> None:
13871387 args = Arguments (positional = (pa .scalar (1 ),))
13881388 with pytest .raises (ValueError , match = "start must be non-negative" ):
13891389 args .get_varargs (- 1 )
1390+
1391+
1392+ class TestAnyArrow :
1393+ """Tests for AnyArrow sentinel type."""
1394+
1395+ def test_any_arrow_accepts_int (self ) -> None :
1396+ """AnyArrow should accept integer values."""
1397+ from vgi .arguments import AnyArrow
1398+
1399+ class MyClass :
1400+ invocation = _MockInvocation (Arguments (positional = (pa .scalar (42 ),)))
1401+ value : AnyArrow = Arg [AnyArrow ](0 ) # type: ignore[assignment]
1402+
1403+ obj = MyClass ()
1404+ assert obj .value == 42
1405+
1406+ def test_any_arrow_accepts_string (self ) -> None :
1407+ """AnyArrow should accept string values."""
1408+ from vgi .arguments import AnyArrow
1409+
1410+ class MyClass :
1411+ invocation = _MockInvocation (Arguments (positional = (pa .scalar ("hello" ),)))
1412+ value : AnyArrow = Arg [AnyArrow ](0 ) # type: ignore[assignment]
1413+
1414+ obj = MyClass ()
1415+ assert obj .value == "hello"
1416+
1417+ def test_any_arrow_accepts_float (self ) -> None :
1418+ """AnyArrow should accept float values."""
1419+ from vgi .arguments import AnyArrow
1420+
1421+ class MyClass :
1422+ invocation = _MockInvocation (Arguments (positional = (pa .scalar (3.14 ),)))
1423+ value : AnyArrow = Arg [AnyArrow ](0 ) # type: ignore[assignment]
1424+
1425+ obj = MyClass ()
1426+ assert obj .value == 3.14
1427+
1428+ def test_any_arrow_accepts_bool (self ) -> None :
1429+ """AnyArrow should accept boolean values."""
1430+ from vgi .arguments import AnyArrow
1431+
1432+ class MyClass :
1433+ invocation = _MockInvocation (Arguments (positional = (pa .scalar (True ),)))
1434+ value : AnyArrow = Arg [AnyArrow ](0 ) # type: ignore[assignment]
1435+
1436+ obj = MyClass ()
1437+ assert obj .value is True
1438+
1439+ def test_any_arrow_accepts_list (self ) -> None :
1440+ """AnyArrow should accept list values."""
1441+ from vgi .arguments import AnyArrow
1442+
1443+ class MyClass :
1444+ invocation = _MockInvocation (Arguments (positional = (pa .scalar ([1 , 2 , 3 ]),)))
1445+ value : AnyArrow = Arg [AnyArrow ](0 ) # type: ignore[assignment]
1446+
1447+ obj = MyClass ()
1448+ assert obj .value == [1 , 2 , 3 ]
1449+
1450+ def test_any_arrow_mixed_types (self ) -> None :
1451+ """Multiple AnyArrow args can have different types."""
1452+ from vgi .arguments import AnyArrow
1453+
1454+ class MyClass :
1455+ invocation = _MockInvocation (
1456+ Arguments (
1457+ positional = (
1458+ pa .scalar (42 ),
1459+ pa .scalar ("text" ),
1460+ pa .scalar (True ),
1461+ )
1462+ )
1463+ )
1464+ int_val : AnyArrow = Arg [AnyArrow ](0 ) # type: ignore[assignment]
1465+ str_val : AnyArrow = Arg [AnyArrow ](1 ) # type: ignore[assignment]
1466+ bool_val : AnyArrow = Arg [AnyArrow ](2 ) # type: ignore[assignment]
1467+
1468+ obj = MyClass ()
1469+ assert obj .int_val == 42
1470+ assert obj .str_val == "text"
1471+ assert obj .bool_val is True
1472+
1473+ def test_any_arrow_with_default (self ) -> None :
1474+ """AnyArrow should support default values."""
1475+ from vgi .arguments import AnyArrow
1476+
1477+ class MyClass :
1478+ invocation = _MockInvocation (Arguments (positional = ()))
1479+ value : AnyArrow = Arg [AnyArrow ](0 , default = "default" ) # type: ignore[assignment]
1480+
1481+ obj = MyClass ()
1482+ assert obj .value == "default"
1483+
1484+ def test_any_arrow_named_argument (self ) -> None :
1485+ """AnyArrow should work with named arguments."""
1486+ from vgi .arguments import AnyArrow
1487+
1488+ class MyClass :
1489+ invocation = _MockInvocation (
1490+ Arguments (named = {"data" : pa .scalar ({"key" : "value" })})
1491+ )
1492+ data : AnyArrow = Arg [AnyArrow ]("data" ) # type: ignore[assignment]
1493+
1494+ obj = MyClass ()
1495+ assert obj .data == {"key" : "value" }
0 commit comments