Debian Codegraph @

tests/test_bind_var_pos.py

raw symbols SCIP
1 def test_bind_var_pos(app):
2 """Checks if "Alice" gets erroneously unpacked into ``("A", "l", "i", "c", "e")``."""
3
4 @app.default
5 def default(*tokens: str):
6 assert tokens == ("Alice",)
7
8 app(["Alice"])
9
10
11 def test_bind_custom_class_only_var_positional(app, assert_parse_args):
12 """It's quite common for classes with *args to really only intend to consume 1 element."""
13
14 class MyCustomClass:
15 def __init__(self, *args):
16 self.args = args
17
18 def __eq__(self, other):
19 return self.args == other.args
20
21 @app.default
22 def default(value: MyCustomClass):
23 pass
24
25 assert_parse_args(default, "100", MyCustomClass("100"))