aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/converters.py20
-rw-r--r--tests/bot/test_converters.py38
2 files changed, 0 insertions, 58 deletions
diff --git a/bot/converters.py b/bot/converters.py
index 1c0fd673d..0118cc48a 100644
--- a/bot/converters.py
+++ b/bot/converters.py
@@ -314,25 +314,6 @@ class TagNameConverter(Converter):
return tag_name
-class TagContentConverter(Converter):
- """Ensure proposed tag content is not empty and contains at least one non-whitespace character."""
-
- @staticmethod
- async def convert(ctx: Context, tag_content: str) -> str:
- """
- Ensure tag_content is non-empty and contains at least one non-whitespace character.
-
- If tag_content is valid, return the stripped version.
- """
- tag_content = tag_content.strip()
-
- # The tag contents should not be empty, or filled with whitespace.
- if not tag_content:
- raise BadArgument("Tag contents should not be empty, or filled with whitespace.")
-
- return tag_content
-
-
class SourceConverter(Converter):
"""Convert an argument into a help command, tag, command, or cog."""
@@ -570,7 +551,6 @@ if t.TYPE_CHECKING:
Inventory = t.Tuple[str, _inventory_parser.InventoryDict] # noqa: F811
Snowflake = int # noqa: F811
TagNameConverter = str # noqa: F811
- TagContentConverter = str # noqa: F811
SourceConverter = SourceType # noqa: F811
DurationDelta = relativedelta # noqa: F811
Duration = datetime # noqa: F811
diff --git a/tests/bot/test_converters.py b/tests/bot/test_converters.py
index 2a1c4e543..6e3a6b898 100644
--- a/tests/bot/test_converters.py
+++ b/tests/bot/test_converters.py
@@ -11,7 +11,6 @@ from bot.converters import (
HushDurationConverter,
ISODateTime,
PackageName,
- TagContentConverter,
TagNameConverter,
)
@@ -26,43 +25,6 @@ class ConverterTests(unittest.IsolatedAsyncioTestCase):
cls.fixed_utc_now = datetime.datetime.fromisoformat('2019-01-01T00:00:00')
- async def test_tag_content_converter_for_valid(self):
- """TagContentConverter should return correct values for valid input."""
- test_values = (
- ('hello', 'hello'),
- (' h ello ', 'h ello'),
- )
-
- for content, expected_conversion in test_values:
- with self.subTest(content=content, expected_conversion=expected_conversion):
- conversion = await TagContentConverter.convert(self.context, content)
- self.assertEqual(conversion, expected_conversion)
-
- async def test_tag_content_converter_for_invalid(self):
- """TagContentConverter should raise the proper exception for invalid input."""
- test_values = (
- ('', "Tag contents should not be empty, or filled with whitespace."),
- (' ', "Tag contents should not be empty, or filled with whitespace."),
- )
-
- for value, exception_message in test_values:
- with self.subTest(tag_content=value, exception_message=exception_message):
- with self.assertRaisesRegex(BadArgument, re.escape(exception_message)):
- await TagContentConverter.convert(self.context, value)
-
- async def test_tag_name_converter_for_valid(self):
- """TagNameConverter should return the correct values for valid tag names."""
- test_values = (
- ('tracebacks', 'tracebacks'),
- ('Tracebacks', 'tracebacks'),
- (' Tracebacks ', 'tracebacks'),
- )
-
- for name, expected_conversion in test_values:
- with self.subTest(name=name, expected_conversion=expected_conversion):
- conversion = await TagNameConverter.convert(self.context, name)
- self.assertEqual(conversion, expected_conversion)
-
async def test_tag_name_converter_for_invalid(self):
"""TagNameConverter should raise the correct exception for invalid tag names."""
test_values = (