diff options
author | 2025-10-09 17:51:37 +0100 | |
---|---|---|
committer | 2025-10-09 17:53:48 +0100 | |
commit | 92a0fb8717862913782ae6e76c47961d052aa4b5 (patch) | |
tree | a7b981d64aae8363eb4c8b441eb45672699acb8d /tests | |
parent | Update EvalJob to fetch default Python version instead of hardcoding (diff) |
Stop using Literal ordering to determine default !eval Python version
Instead of using typing.get_args(...) and fetching the first value
returned (which is mostly safe, but not guaranteed to be so), use a new
constant DEFAULT_PYTHON_VERSION to control the current default Python
executor when no explicit interpreter version is passed.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bot/exts/utils/snekbox/test_snekbox.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/bot/exts/utils/snekbox/test_snekbox.py b/tests/bot/exts/utils/snekbox/test_snekbox.py index 69262bf61..7a0a70385 100644 --- a/tests/bot/exts/utils/snekbox/test_snekbox.py +++ b/tests/bot/exts/utils/snekbox/test_snekbox.py @@ -1,7 +1,6 @@ import asyncio import unittest from base64 import b64encode -from typing import get_args from unittest.mock import AsyncMock, MagicMock, Mock, call, create_autospec, patch from discord import AllowedMentions @@ -11,7 +10,8 @@ from pydis_core.utils.paste_service import MAX_PASTE_SIZE from bot import constants from bot.errors import LockedResourceError from bot.exts.utils import snekbox -from bot.exts.utils.snekbox import EvalJob, EvalResult, Snekbox, SupportedPythonVersions +from bot.exts.utils.snekbox import EvalJob, EvalResult, Snekbox +from bot.exts.utils.snekbox._constants import DEFAULT_PYTHON_VERSION from bot.exts.utils.snekbox._io import FileAttachment from tests.helpers import MockBot, MockContext, MockMember, MockMessage, MockReaction, MockUser @@ -22,7 +22,7 @@ class SnekboxTests(unittest.IsolatedAsyncioTestCase): self.bot = MockBot() self.cog = Snekbox(bot=self.bot) self.job = EvalJob.from_code("import random") - self.default_version = get_args(SupportedPythonVersions)[0] + self.default_version = DEFAULT_PYTHON_VERSION @staticmethod def code_args(code: str) -> tuple[EvalJob]: |