From 36994134c27469cbd050c143337634a40a4471d9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 26 Jun 2020 10:42:24 +0000 Subject: [PATCH] Function not needed --- content.py | 25 ------------------------- tests.py | 17 ----------------- 2 files changed, 42 deletions(-) diff --git a/content.py b/content.py index 938837abc..6fae45675 100644 --- a/content.py +++ b/content.py @@ -14,31 +14,6 @@ from utils import fileLastModified from utils import getLinkPrefixes -def getMentionsString(content: str) -> []: - """Returns the initial string containing mentions from the post content - and the content string without the initial mentions - """ - if ' ' not in content: - # Doesn't contain any distinct words - return ['', content] - if '@' not in content: - # Nothing which could be a mention - return ['', content] - messageStr = content.strip() - if not messageStr.startswith('@'): - # There are no mentions - return ['', content] - words = messageStr.split(' ') - # get each mentioned handle - mentions = '' - for handle in words: - if not handle.startswith('@'): - break - mentions += handle + ' ' - messageStr = content.replace(mentions, '') - return [mentions.strip(), messageStr] - - def switchWords(baseDir: str, nickname: str, domain: str, content: str) -> str: """Performs word replacements. eg. Trump -> The Orange Menace """ diff --git a/tests.py b/tests.py index 9fbb7374e..9cd7d21d2 100644 --- a/tests.py +++ b/tests.py @@ -64,7 +64,6 @@ from media import getAttachmentMediaType from delete import sendDeleteViaServer from inbox import validInbox from inbox import validInboxFilenames -from content import getMentionsString from content import addWebLinks from content import replaceEmojiFromTags from content import addHtmlTags @@ -1866,24 +1865,8 @@ def testSiteIsActive(): assert(not siteIsActive('https://notarealwebsite.a.b.c')) -def testGetMentionsString(): - print('testGetMentionsString') - content = 'This post has no mentions' - result = getMentionsString(content) - assert len(result) == 2 - assert not result[0] - assert result[1] == 'This post has no mentions' - - content = '@nick@abc @sue@def This post has no mentions' - result = getMentionsString(content) - assert len(result) == 2 - assert result[0] == '@nick@abc @sue@def' - assert result[1] == 'This post has no mentions' - - def runAllTests(): print('Running tests...') - testGetMentionsString() testSiteIsActive() testJsonld() testRemoveTextFormatting()