Example #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)
Example #2
0
 def test_multiple_spaces(self):
     assert typogen.reverse_letters('   cat   ') == {'act', 'cta'}
     assert typogen.reverse_letters('   frog   ') == {
         'rfog',
         'forg',
         'frgo',
     }
     assert typogen.reverse_letters('   bull   ') == {'ubll', 'blul'}
     assert typogen.reverse_letters('   cat   frog   ') == {
         'act frog',
         'cta frog',
         'ca tfrog',
         'catf rog',
         'cat rfog',
         'cat forg',
         'cat frgo',
     }
     assert typogen.reverse_letters('   ') == set()
Example #3
0
 def test_with_space(self):
     assert typogen.reverse_letters('cat frog') == {
         'act frog',
         'cta frog',
         'ca tfrog',
         'catf rog',
         'cat rfog',
         'cat forg',
         'cat frgo',
     }
Example #4
0
 def test_simple(self):
     assert typogen.reverse_letters('cat') == {'act', 'cta'}
     assert typogen.reverse_letters('frog') == {'rfog', 'forg', 'frgo'}
Example #5
0
 def test_empty(self):
     assert typogen.reverse_letters('') == set()
Example #6
0
 def test_double(self):
     assert typogen.reverse_letters('bull') == {'ubll', 'blul'}