None rather than false

merge-requests/26/head
Bob Mottram 2021-10-18 14:32:41 +01:00
parent ad72cf11f2
commit a35c809668
2 changed files with 9 additions and 3 deletions

View File

@ -38,14 +38,14 @@ def previousConversationPostId(baseDir: str, nickname: str, domain: str,
conversationFilename = \
_getConversationFilename(baseDir, nickname, domain, postJsonObject)
if not conversationFilename:
return False
return None
if not os.path.isfile(conversationFilename):
return False
return None
with open(conversationFilename, 'r') as fp:
lines = fp.readlines()
if lines:
return lines[-1].replace('\n', '')
return False
return None
def updateConversation(baseDir: str, nickname: str, domain: str,

View File

@ -5743,10 +5743,16 @@ def _testWordsSimilarity() -> None:
"The world of the electron and the webkit, the beauty of the baud"
similarity = wordsSimilarity(content1, content2, minWords)
assert similarity > 70
content1 = "<p>We&apos;re growing! </p><p>A new writer and developer is joining TuxPhones. You probably know him already from his open-source work - but let&apos;s not spoil too much \ud83d\udd2e</p>"
content2 = "<p>We&apos;re growing! </p><p>A new writer and developer is joining TuxPhones. You probably know them already from their open-source work - but let&apos;s not spoil too much \ud83d\udd2e</p>"
similarity = wordsSimilarity(content1, content2, minWords)
assert similarity > 85
def runAllTests():
baseDir = os.getcwd()
_testWordsSimilarity()
return
print('Running tests...')
updateDefaultThemesList(os.getcwd())
_translateOntology(baseDir)