Example #1
0
def test_encrypt_letter():
    """
    Test basic encrypt letters function with lower and upper case letters
    """
    assert Ceasar._encrypt_letter("a", 1) == "b"
    assert Ceasar._encrypt_letter("j", 5) == "o"
    assert Ceasar._encrypt_letter("x", 2) == "z"
    assert Ceasar._encrypt_letter("J", 5) == "O"
    assert Ceasar._encrypt_letter("X", 2) == "Z"
Example #2
0
def test_encrypt_letter_wrap_long():
    """
    Test basic encrypt letters function, wrapping around 1 or more times
    """
    assert Ceasar._encrypt_letter("j", 30) == "n"
    assert Ceasar._encrypt_letter("Z", 94) == "P"
Example #3
0
def test_encrypt_letter_wrap():
    """
    Test basic encrypt letters function, wrapping around the alphabet
    """
    assert Ceasar._encrypt_letter("z", 1) == "a"
    assert Ceasar._encrypt_letter("Z", 5) == "E"
Example #4
0
def test_encrypt_letter_non_character():
    """
    Assert there is an error when trying to encrypt a non character
    """
    with pytest.raises(NotAllowedValue):
        assert Ceasar._encrypt_letter("0", 10)
Example #5
0
def test_encrypt_letter_no_offset():
    """
    Test basic encrypt letters function omitting `offset` parameter
    """
    assert Ceasar._encrypt_letter("r") == "r"