예제 #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'