From 9d89bb5f94dd91e05ac10ef91b73f7450c6e1110 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 8 Nov 2020 11:24:43 +0000 Subject: [PATCH] Test for getting the first paragraph --- tests.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests.py b/tests.py index 8a75dbed..f835378c 100644 --- a/tests.py +++ b/tests.py @@ -32,6 +32,7 @@ from follow import clearFollows from follow import clearFollowers from follow import sendFollowRequestViaServer from follow import sendUnfollowRequestViaServer +from utils import firstParagraphFromString from utils import removeIdEnding from utils import siteIsActive from utils import updateRecentPostsCache @@ -2336,8 +2337,22 @@ def testGetNewswireTags(): assert '#ExcitingHashtag' in tags +def testFirstParagraphFromString(): + print('testFirstParagraphFromString') + testStr = \ + '

This is a test

' + \ + '

This is another paragraph

' + resultStr = firstParagraphFromString(testStr) + assert resultStr == 'This is a test' + + testStr = 'Testing without html' + resultStr = firstParagraphFromString(testStr) + assert resultStr == testStr + + def runAllTests(): print('Running tests...') + testFirstParagraphFromString() testGetNewswireTags() testHashtagRuleTree() testRemoveHtmlTag()