Skip to content

Commit c563100

Browse files
committed
feat: test caeser added
1 parent 63b122a commit c563100

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

.github/workflows/python-app.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ jobs:
3434
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3535
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3636
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37-
#- name: Test with pytest
38-
# run: |
39-
# pytest
37+
- name: Test with pytest
38+
run: |
39+
pytest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
venv/
2+
__pycache__/
3+

test/test_caeser.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import pytest
2+
from caeser import Caeser
3+
4+
@pytest.fixture
5+
def caeser():
6+
return Caeser(3) # Use shift=3 for testing
7+
8+
def test_encrypt(caeser):
9+
assert caeser.encrypt("abc") == "def"
10+
assert caeser.encrypt("xyz") == "abc"
11+
assert caeser.encrypt("Hello") == "Khoor"
12+
assert caeser.encrypt("Python 3.11!") == "Sbwkrq 3.11!"
13+
14+
def test_decrypt(caeser):
15+
assert caeser.decrypt("def") == "abc"
16+
assert caeser.decrypt("abc") == "xyz"
17+
assert caeser.decrypt("Khoor") == "Hello"
18+
assert caeser.decrypt("Sbwkrq 3.11!") == "Python 3.11!"
19+
20+
def test_no_change_for_non_alphabetic(caeser):
21+
assert caeser.encrypt("1234567890") == "1234567890"
22+
assert caeser.decrypt("1234567890") == "1234567890"
23+
assert caeser.encrypt("!@#$%^&*()") == "!@#$%^&*()"
24+
assert caeser.decrypt("!@#$%^&*()") == "!@#$%^&*()"

0 commit comments

Comments
 (0)