Minor documentation updates
[szyfrow.git] / tests / test_languge_models.py
1 import pytest
2 import string
3
4 from szyfrow.support.language_models import *
5
6 def test_transpositions_of():
7 assert transpositions_of('clever') == (0, 2, 1, 4, 3)
8 assert transpositions_of('fred') == (3, 2, 0, 1)
9 assert transpositions_of((3, 2, 0, 1)) == (3, 2, 0, 1)
10
11 def test_ngrams():
12 assert ngrams(sanitise('the quick brown fox'), 2) == ['th', 'he', 'eq',
13 'qu', 'ui', 'ic', 'ck', 'kb', 'br', 'ro', 'ow', 'wn',
14 'nf', 'fo', 'ox']
15 assert ngrams(sanitise('the quick brown fox'), 4) == ['theq', 'hequ',
16 'equi', 'quic', 'uick', 'ickb', 'ckbr', 'kbro', 'brow',
17 'rown', 'ownf', 'wnfo', 'nfox']
18