From a7b0634d1e9174b9da11419544e8dcf5bdbd960e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 21 Feb 2020 09:53:36 +0000 Subject: [PATCH] Check a few emoji cases --- tests.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests.py b/tests.py index fb02c1b5..ca91869a 100644 --- a/tests.py +++ b/tests.py @@ -1352,9 +1352,8 @@ def testWebLinks(): assert resultText=='

ABCABCABCABCABCABCABCABCABCABCABCABCABCA<\p>' -def testAddEmoji(): - print('testAddEmoji') - content='Emoji :lemon: :strawberry: :banana:' +def testAddEmoji(content: str,emojiStr:str): + print('testAddEmoji: '+emojiStr) httpPrefix='http' nickname='testuser' domain='testdomain.net' @@ -1383,14 +1382,16 @@ def testAddEmoji(): addHtmlTags(baseDir,httpPrefix, \ nickname,domain,content, \ recipients,hashtags,True) - assert ':lemon:' in contentModified + assert ':'+emojiStr+':' in contentModified + assert contentModified.startswith('

') + assert contentModified.endswith('

') tags=[] for tagName,tag in hashtags.items(): tags.append(tag) content=contentModified contentModified=replaceEmojiFromTags(content,tags,'content') assert 'img src' in contentModified - assert ':lemon:' not in contentModified + assert ':'+emojiStr+':' not in contentModified os.chdir(baseDirOriginal) shutil.rmtree(baseDirOriginal+'/.tests') @@ -1472,7 +1473,9 @@ def runAllTests(): testSaveLoadJson() testCommentJson() testGetStatusNumber() - testAddEmoji() + testAddEmoji("Emoji :lemon: :strawberry: :banana:","lemon") + testAddEmoji("Emoji :lemon: :strawberry: :banana:","banana") + testAddEmoji("G'day world :worldmap:","worldmap") testActorParsing() testHttpsig() testCache()