mirror of https://gitlab.com/bashrc2/epicyon
None rather than false
parent
ad72cf11f2
commit
a35c809668
|
@ -38,14 +38,14 @@ def previousConversationPostId(baseDir: str, nickname: str, domain: str,
|
||||||
conversationFilename = \
|
conversationFilename = \
|
||||||
_getConversationFilename(baseDir, nickname, domain, postJsonObject)
|
_getConversationFilename(baseDir, nickname, domain, postJsonObject)
|
||||||
if not conversationFilename:
|
if not conversationFilename:
|
||||||
return False
|
return None
|
||||||
if not os.path.isfile(conversationFilename):
|
if not os.path.isfile(conversationFilename):
|
||||||
return False
|
return None
|
||||||
with open(conversationFilename, 'r') as fp:
|
with open(conversationFilename, 'r') as fp:
|
||||||
lines = fp.readlines()
|
lines = fp.readlines()
|
||||||
if lines:
|
if lines:
|
||||||
return lines[-1].replace('\n', '')
|
return lines[-1].replace('\n', '')
|
||||||
return False
|
return None
|
||||||
|
|
||||||
|
|
||||||
def updateConversation(baseDir: str, nickname: str, domain: str,
|
def updateConversation(baseDir: str, nickname: str, domain: str,
|
||||||
|
|
6
tests.py
6
tests.py
|
@ -5743,10 +5743,16 @@ def _testWordsSimilarity() -> None:
|
||||||
"The world of the electron and the webkit, the beauty of the baud"
|
"The world of the electron and the webkit, the beauty of the baud"
|
||||||
similarity = wordsSimilarity(content1, content2, minWords)
|
similarity = wordsSimilarity(content1, content2, minWords)
|
||||||
assert similarity > 70
|
assert similarity > 70
|
||||||
|
content1 = "<p>We're growing! </p><p>A new writer and developer is joining TuxPhones. You probably know him already from his open-source work - but let's not spoil too much \ud83d\udd2e</p>"
|
||||||
|
content2 = "<p>We're growing! </p><p>A new writer and developer is joining TuxPhones. You probably know them already from their open-source work - but let's not spoil too much \ud83d\udd2e</p>"
|
||||||
|
similarity = wordsSimilarity(content1, content2, minWords)
|
||||||
|
assert similarity > 85
|
||||||
|
|
||||||
|
|
||||||
def runAllTests():
|
def runAllTests():
|
||||||
baseDir = os.getcwd()
|
baseDir = os.getcwd()
|
||||||
|
_testWordsSimilarity()
|
||||||
|
return
|
||||||
print('Running tests...')
|
print('Running tests...')
|
||||||
updateDefaultThemesList(os.getcwd())
|
updateDefaultThemesList(os.getcwd())
|
||||||
_translateOntology(baseDir)
|
_translateOntology(baseDir)
|
||||||
|
|
Loading…
Reference in New Issue