Esempio n. 1
0
def main(text, **kwargs):
    all_typos = not kwargs['skip_letter'] and \
                not kwargs['double_letter'] and \
                not kwargs['reverse_letters'] and \
                not kwargs['skip_spaces'] and \
                not kwargs['missed_key'] and \
                not kwargs['inserted_key']

    if all_typos or kwargs['skip_letter']:
        for typo in typogen.skip_letter(text):
            click.echo(typo)

    if all_typos or kwargs['double_letter']:
        for typo in typogen.double_letter(text):
            click.echo(typo)

    if all_typos or kwargs['reverse_letters']:
        for typo in typogen.reverse_letters(text):
            click.echo(typo)

    if all_typos or kwargs['skip_spaces']:
        for typo in typogen.skip_spaces(text):
            click.echo(typo)

    if all_typos or kwargs['missed_key']:
        for typo in typogen.missed_key(text):
            click.echo(typo)

    if all_typos or kwargs['inserted_key']:
        for typo in typogen.inserted_key(text):
            click.echo(typo)
Esempio n. 2
0
 def test_multiple_spaces(self):
     assert typogen.skip_letter('   cat   ') == {'at', 'ct', 'ca'}
     assert typogen.skip_letter('   frog   ') == {
         'rog',
         'fog',
         'frg',
         'fro',
     }
     assert typogen.skip_letter('   bull   ') == {'ull', 'bll', 'bul'}
     assert typogen.skip_letter('   cat   frog   ') == {
         'at frog',
         'ct frog',
         'ca frog',
         'cat rog',
         'cat fog',
         'cat frg',
         'cat fro',
     }
     assert typogen.skip_letter('   ') == set()
Esempio n. 3
0
 def test_with_space(self):
     assert typogen.skip_letter('cat frog') == {
         'at frog',
         'ct frog',
         'ca frog',
         'cat rog',
         'cat fog',
         'cat frg',
         'cat fro',
     }
Esempio n. 4
0
 def test_double(self):
     assert typogen.skip_letter('bull') == {'ull', 'bll', 'bul'}
Esempio n. 5
0
 def test_simple(self):
     assert typogen.skip_letter('cat') == {'at', 'ct', 'ca'}
     assert typogen.skip_letter('frog') == {'rog', 'fog', 'frg', 'fro'}
Esempio n. 6
0
 def test_empty(self):
     assert typogen.skip_letter('') == set()