From 92a0fb8717862913782ae6e76c47961d052aa4b5 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Thu, 9 Oct 2025 17:51:37 +0100 Subject: 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. --- tests/bot/exts/utils/snekbox/test_snekbox.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') 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]: -- cgit v1.2.3