Skip to content

Commit 8d76921

Browse files
committed
🐛 fix dictionary access in test_typing_annotated.py to be type safe
1 parent 330161c commit 8d76921

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/test_typing_annotated.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async def echo(ctx, txt: Annotated[str, discord.Option()]):
1515
bot = discord.Bot()
1616
bot.add_application_command(cmd)
1717
dict_result = cmd.to_dict()
18-
assert dict_result.get("options")[0].get("type") == SlashCommandOptionType.string.value
18+
assert dict_result["options"][0].get("type") == SlashCommandOptionType.string.value
1919

2020

2121
def test_typing_annotated_decorator():
@@ -27,7 +27,7 @@ async def echo(ctx, txt: Annotated[str, discord.Option(description="Some text")]
2727

2828
dict_result = echo.to_dict()
2929

30-
option = dict_result.get("options")[0]
30+
option = dict_result["options"][0]
3131
assert option.get("type") == SlashCommandOptionType.string.value
3232
assert option.get("description") == "Some text"
3333

@@ -48,7 +48,7 @@ async def echo(self, ctx, txt: Annotated[str, discord.Option(description="Some t
4848

4949
dict_result = cog.echo.to_dict()
5050

51-
option = dict_result.get("options")[0]
51+
option = dict_result["options"][0]
5252
assert option.get("type") == SlashCommandOptionType.string.value
5353
assert option.get("description") == "Some text"
5454

@@ -71,7 +71,7 @@ async def echo(self, ctx, txt: Annotated[str, discord.Option(description="Some t
7171

7272
dict_result = cog.echo.to_dict()
7373

74-
option = dict_result.get("options")[0]
74+
option = dict_result["options"][0]
7575
assert option.get("type") == SlashCommandOptionType.string.value
7676
assert option.get("description") == "Some text"
7777

@@ -86,7 +86,7 @@ async def echo(ctx, txt: Annotated[Optional[str], discord.Option()]):
8686

8787
dict_result = cmd.to_dict()
8888

89-
option = dict_result.get("options")[0]
89+
option = dict_result["options"][0]
9090
assert option.get("type") == SlashCommandOptionType.string.value
9191

9292

@@ -100,7 +100,7 @@ async def echo(ctx, txt: str):
100100

101101
dict_result = cmd.to_dict()
102102

103-
option = dict_result.get("options")[0]
103+
option = dict_result["options"][0]
104104
assert option.get("type") == SlashCommandOptionType.string.value
105105

106106

@@ -114,5 +114,5 @@ async def echo(ctx, txt: Annotated[str, "..."]):
114114

115115
dict_result = cmd.to_dict()
116116

117-
option = dict_result.get("options")[0]
117+
option = dict_result["options"][0]
118118
assert option.get("type") == SlashCommandOptionType.string.value

0 commit comments

Comments
 (0)