aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Shivansh-007 <[email protected]>2021-10-11 12:52:39 +0530
committerGravatar Shivansh-007 <[email protected]>2021-10-11 12:52:39 +0530
commit863c8d76c66ea748af9ab29bad1d02d16e3888f2 (patch)
treee1ca7ec9589d8336613ff951eda64cbf09b34da5 /tests
parentApply requested grammar and style changes (diff)
Refactor `shorten_text` utility function
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/exts/moderation/test_incidents.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/bot/exts/moderation/test_incidents.py b/tests/bot/exts/moderation/test_incidents.py
index 3bdc9128c..8304af1c0 100644
--- a/tests/bot/exts/moderation/test_incidents.py
+++ b/tests/bot/exts/moderation/test_incidents.py
@@ -795,9 +795,16 @@ class TestMessageLinkEmbeds(TestIncidents):
async def test_shorten_text(self):
"""Test all cases of text shortening by mocking messages."""
tests = {
- "thisisasingleword"*10: ('thisisasingleword'*10)[:50]+"...",
- "\n".join("Lets make a new line test".split()): "Lets\nmake\na"+"...",
- 'Hello, World!' * 300: ('Hello, World!' * 300)[:300] + '...'
+ "thisisasingleword"*10: "thisisasinglewordthisisasinglewordthisisasinglewor...",
+
+ "\n".join("Lets make a new line test".split()): "Lets\nmake\na...",
+
+ 'Hello, World!' * 300: (
+ "Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!"
+ "Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!"
+ "Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!Hello, World!"
+ "Hello, World!Hello, World!H..."
+ )
}
for content, expected_conversion in tests.items():
@@ -829,8 +836,10 @@ class TestMessageLinkEmbeds(TestIncidents):
incident_msg = MockMessage(
id=777,
- content=f"I would like to report the following messages, "
- f"as they break our rules: \n{', '.join(msg_links)}"
+ content=(
+ f"I would like to report the following messages, "
+ f"as they break our rules: \n{', '.join(msg_links)}"
+ )
)
with patch(