Skip to content

Commit 9107b39

Browse files
committed
fix: normalize args to tuple before BotCommand construction and assertion checks
1 parent 7af3087 commit 9107b39

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

csp_bot_commands/tests/test_fun.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def test_statics(self):
5757
],
5858
)
5959
def test_execute(self, args):
60+
if isinstance(args, str):
61+
args = (args,)
6062
msg = cmd.execute(
6163
BotCommand(
6264
backend="slack",
@@ -65,7 +67,7 @@ def test_execute(self, args):
6567
id="123",
6668
),
6769
targets=(User(id="456"),),
68-
args=(args,) if isinstance(args, str) else args,
70+
args=args,
6971
)
7072
)
7173
assert msg is not None

csp_bot_commands/tests/test_thanks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def test_statics(self):
2121
],
2222
)
2323
def test_execute(self, args):
24+
if isinstance(args, str):
25+
args = (args,)
2426
msg = cmd.execute(
2527
BotCommand(
2628
backend="slack",
@@ -29,7 +31,7 @@ def test_execute(self, args):
2931
id="123",
3032
),
3133
targets=(User(id="456"),),
32-
args=(args,) if isinstance(args, str) else args,
34+
args=args,
3335
)
3436
)
3537
assert msg is not None

csp_bot_commands/tests/test_trout.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def test_statics(self):
2121
],
2222
)
2323
def test_execute(self, args):
24+
if isinstance(args, str):
25+
args = (args,)
2426
msg = cmd.execute(
2527
BotCommand(
2628
backend="slack",
@@ -29,7 +31,7 @@ def test_execute(self, args):
2931
id="123",
3032
),
3133
targets=(User(id="456"),),
32-
args=(args,) if isinstance(args, str) else args,
34+
args=args,
3335
)
3436
)
3537
assert msg is not None

0 commit comments

Comments
 (0)