From: Neil Smith Date: Wed, 28 Mar 2018 09:29:26 +0000 (+0100) Subject: Updated some tests X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=79f017cbe657922d163f9ca6bfa0f1cdf3d3658c;p=cipher-tools.git Updated some tests --- diff --git a/support/language_models.py b/support/language_models.py index 791d083..1b21e49 100644 --- a/support/language_models.py +++ b/support/language_models.py @@ -6,6 +6,7 @@ from math import log10 import os import support.norms +from support.utilities import sanitise def datafile(name, sep='\t'): """Read key,value pairs from file. @@ -109,7 +110,7 @@ def cosine_distance_score(text): of the frequency distribution. >>> cosine_distance_score('abcabc') # doctest: +ELLIPSIS - 0.73777... + 0.73771... """ # return support.norms.cosine_distance(english_counts, # collections.Counter(sanitise(text))) diff --git a/test/test_doctests.py b/test/test_doctests.py index 0af5050..7cd16f7 100644 --- a/test/test_doctests.py +++ b/test/test_doctests.py @@ -14,9 +14,14 @@ import cipher.bifid import cipher.autokey import cipher.pocket_enigma +import support.language_models +import support.norms +import support.segment +import support.text_prettify +import support.utilities -def load_tests(loader, tests, ignore): +def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(cipher.caesar)) tests.addTests(doctest.DocTestSuite(cipher.affine)) tests.addTests(doctest.DocTestSuite(cipher.keyword_cipher)) @@ -30,4 +35,11 @@ def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(cipher.autokey)) tests.addTests(doctest.DocTestSuite(cipher.pocket_enigma, extraglobs={'pe': cipher.pocket_enigma.PocketEnigma(1, 'a')})) + + tests.addTests(doctest.DocTestSuite(support.language_models)) + tests.addTests(doctest.DocTestSuite(support.norms)) + tests.addTests(doctest.DocTestSuite(support.segment)) + tests.addTests(doctest.DocTestSuite(support.text_prettify)) + tests.addTests(doctest.DocTestSuite(support.utilities)) + return tests