Updated some tests
authorNeil Smith <neil.git@njae.me.uk>
Wed, 28 Mar 2018 09:29:26 +0000 (10:29 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Wed, 28 Mar 2018 09:29:26 +0000 (10:29 +0100)
support/language_models.py
test/test_doctests.py

index 791d0836dbc85da75bf4004f64fc31f4710a8531..1b21e49b1190ff4cbc2e0bc480a12c5cb2d12a3f 100644 (file)
@@ -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)))
index 0af5050de483c8e34b7a274d2743925e62dd4faf..7cd16f74c8ada6c63172776099b229f802305943 100644 (file)
@@ -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