示例#1
0
    def test_one_alpha(self):
        ''' Testing with one alpha character and length = group_length'''

        assert a2.encipher('a', 5, dictionary) == '|,nxs', 'One alpha str failed'
示例#2
0
    def test_space(self):
        ''' Testing with space in str.'''

        assert a2.encipher(
            'Hi Jonathan', 5, dictionary
        ) == '\\* t1sE`sv|,nxv', 'Str with space in the middle failed'
示例#3
0
    def test_stop_in_str(self):
        ''' Testing with STOP in str to be enciphered.'''

        assert a2.encipher(
            'STOP', 5,
            dictionary) == 'x|,nx  |,n', 'Str with STOP in plaintext'
示例#4
0
    def test_numbers(self):
        ''' Testing with numbers as str.'''

        assert a2.encipher(
            '456', 5,
            dictionary) == 'nxR>2   |,', 'Multiple numbers as str failed'
示例#5
0
    def test_multiple_punctuations(self):
        ''' Testing with multiple punctuations.'''

        assert a2.encipher(
            '&?"', 5,
            dictionary) == 'nxIu{   |,', 'Multiple punctuations failed'
示例#6
0
    def test_upper_alpha(self):
        ''' Testing with one upper alpha character.'''

        assert a2.encipher('A', 5,
                           dictionary) == '|,nx)', 'One upper alpha str failed'
示例#7
0
    def test_mix_alpha(self):
        ''' Testing with mix of upper and lower alpha characters.'''

        assert a2.encipher(
            'aBcD', 5, dictionary
        ) == 'x9(}s  |,n', 'Mix of upper and lower alpha str failed'
示例#8
0
    def test_numbers(self):
        ''' Testing with numbers as str.'''

        assert a2.encipher('456', 5, dictionary) == 'nxR>2   |,', 'Multiple numbers as str failed'
示例#9
0
    def test_punctuation(self):
        ''' Testing with punctuation.'''

        assert a2.encipher('%', 5, dictionary) == '|,nxC', 'Punctuation failed'
示例#10
0
    def test_mix_alpha(self):
        ''' Testing with mix of upper and lower alpha characters.'''

        assert a2.encipher('aBcD', 5, dictionary) == 'x9(}s  |,n', 'Mix of upper and lower alpha str failed'
示例#11
0
    def test_number(self):
        ''' Testing with number as str.'''

        assert a2.encipher('3', 5, dictionary) == '|,nx0', 'One number as str failed'
示例#12
0
    def test_multiple_upper_alpha(self):
        ''' Testing with multiple upper alpha characters.'''

        assert a2.encipher('ABC', 5, dictionary) == 'nxG})   |,', 'Multiple upper alpha str failed'
示例#13
0
    def test_upper_alpha(self):
        ''' Testing with one upper alpha character.'''

        assert a2.encipher('A', 5, dictionary) == '|,nx)', 'One upper alpha str failed'
示例#14
0
    def test_multiple_alpha(self):
        ''' Testing with multiple alpha characters and length != group_length'''

        assert a2.encipher('abc', 5, dictionary) == 'nx(Ss   |,', 'Multiple alpha str failed'
示例#15
0
    def test_one_alpha(self):
        ''' Testing with one alpha character and length = group_length'''

        assert a2.encipher('a', 5,
                           dictionary) == '|,nxs', 'One alpha str failed'
示例#16
0
    def test_multiple_punctuations(self):
        ''' Testing with multiple punctuations.'''

        assert a2.encipher('&?"', 5, dictionary) == 'nxIu{   |,', 'Multiple punctuations failed'
示例#17
0
    def test_multiple_alpha(self):
        ''' Testing with multiple alpha characters and length != group_length'''

        assert a2.encipher(
            'abc', 5, dictionary) == 'nx(Ss   |,', 'Multiple alpha str failed'
示例#18
0
    def test_numbers_alpha_puntc(self):
        ''' Testing with upper and lower alpha, punctuations and numbers as str.'''

        assert a2.encipher('aB1?', 5, dictionary) == 'xub}s  |,n', 'Mix of upper, lower alpha, punctuations, and numbers as str failed'
示例#19
0
    def test_multiple_upper_alpha(self):
        ''' Testing with multiple upper alpha characters.'''

        assert a2.encipher(
            'ABC', 5,
            dictionary) == 'nxG})   |,', 'Multiple upper alpha str failed'
示例#20
0
    def test_space(self):
        ''' Testing with space in str.'''

        assert a2.encipher('Hi Jonathan', 5, dictionary) == '\\* t1sE`sv|,nxv', 'Str with space in the middle failed'
示例#21
0
    def test_number(self):
        ''' Testing with number as str.'''

        assert a2.encipher('3', 5,
                           dictionary) == '|,nx0', 'One number as str failed'
示例#22
0
    def test_new_line(self):
        ''' Testing with muliple lines in file.'''

        assert a2.encipher('New\nLine', 5, dictionary) == "O\nD6'nx6vt   |,", 'Str with multiple lines failed'
示例#23
0
    def test_punctuation(self):
        ''' Testing with punctuation.'''

        assert a2.encipher('%', 5, dictionary) == '|,nxC', 'Punctuation failed'
示例#24
0
    def test_stop_in_str(self):
        ''' Testing with STOP in str to be enciphered.'''

        assert a2.encipher('STOP', 5, dictionary) == 'x|,nx  |,n', 'Str with STOP in plaintext'
示例#25
0
    def test_numbers_alpha_puntc(self):
        ''' Testing with upper and lower alpha, punctuations and numbers as str.'''

        assert a2.encipher(
            'aB1?', 5, dictionary
        ) == 'xub}s  |,n', 'Mix of upper, lower alpha, punctuations, and numbers as str failed'
示例#26
0
def test_encipher_type():
    ensure(a2.encipher.__code__.co_argcount == 3, 'argument number test')
    result = a2.encipher('hello', 5, {'e': '9'})
    ensure(type(result) == str, 'return type')
示例#27
0
    def test_new_line(self):
        ''' Testing with muliple lines in file.'''

        assert a2.encipher(
            'New\nLine', 5,
            dictionary) == "O\nD6'nx6vt   |,", 'Str with multiple lines failed'
示例#28
0
    def test_empty(self):
        ''' Testing with empty plaintext.'''

        assert a2.encipher('', 5, dictionary) == ' |,nx', 'Empty str failed'
def test_encipher_type():
    ensure(a2.encipher.__code__.co_argcount == 3, 'argument number test')
    result = a2.encipher('hello', 5, {'e': '9'})
    ensure(type(result) == str, 'return type')
示例#30
0
    def test_empty(self):
        ''' Testing with empty plaintext.'''

        assert a2.encipher('', 5, dictionary) == ' |,nx', 'Empty str failed'