Пример #1
0
def test_decode_long():
    #   https://www.lipsum.com
    test_str = 'ORUHP LSVXP GRORU VLW DPHW FRQVHFWHWXU DGLSLVFLQJ HOLW PDXULV DXJXH QLVL VROOLFLWXGLQ LG VDJLWWLV VHG ' \
               'WULVWLTXH YHO LSVXP SURLQ DOLTXDP OXFWXV PDXULV '
    assert cc.decode(
        test_str,
        3) == 'LOREM IPSUM DOLOR SIT AMET CONSECTETUR ADIPISCING ELIT MAURIS AUGUE NISI SOLLICITUDIN ID SAGITTIS SED ' \
              'TRISTIQUE VEL IPSUM PROIN ALIQUAM LUCTUS MAURIS '
Пример #2
0
def test_encode():
    test_str = 'ABCDXYZ'
    assert cc.encode(test_str, 3) == 'DEFGABC'
Пример #3
0
def test_empty_str_in():
    with pytest.raises(AssertionError):
        test_str = ''
        cc.encode(test_str, 3)
Пример #4
0
def test_negative_stride():
    test_str = 'XYZABC'
    assert cc.encode(test_str, -3) == 'UVWXYZ'
Пример #5
0
def test_decode_invalid_char():
    test_str = 'ab_34_$%'
    assert cc.decode(test_str, 3) == 'ab_34_$%'
Пример #6
0
def test_decode():
    test_str = 'DEFGABC'
    assert cc.decode(test_str, 3) == 'ABCDXYZ'