aboutsummaryrefslogtreecommitdiff
path: root/challenge-273/iangoodnight/python/tests/test_task1.py
diff options
context:
space:
mode:
authorIan Goodnight <ian.goodnight@scythe.io>2024-06-16 14:44:45 -0400
committerIan Goodnight <ian.goodnight@scythe.io>2024-06-16 14:44:45 -0400
commitd87e83206ea21bc2290ce459ffba878e94e49f95 (patch)
tree1cdd10ba3c58cf4925668c14a886e63041aa8634 /challenge-273/iangoodnight/python/tests/test_task1.py
parent194611acf9d0f7f165ac0ec595774b2c6fd5f413 (diff)
downloadperlweeklychallenge-club-d87e83206ea21bc2290ce459ffba878e94e49f95.tar.gz
perlweeklychallenge-club-d87e83206ea21bc2290ce459ffba878e94e49f95.tar.bz2
perlweeklychallenge-club-d87e83206ea21bc2290ce459ffba878e94e49f95.zip
week 273
Diffstat (limited to 'challenge-273/iangoodnight/python/tests/test_task1.py')
-rw-r--r--challenge-273/iangoodnight/python/tests/test_task1.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/challenge-273/iangoodnight/python/tests/test_task1.py b/challenge-273/iangoodnight/python/tests/test_task1.py
new file mode 100644
index 0000000000..b27365fdac
--- /dev/null
+++ b/challenge-273/iangoodnight/python/tests/test_task1.py
@@ -0,0 +1,22 @@
+"""Tests for task1.py"""
+from python.task1 import percentage_of_character
+
+
+def test_examples() -> None:
+ """Test if function returns correct percentage of character"""
+ assert percentage_of_character("perl", "e") == 25
+ assert percentage_of_character("java", "a") == 50
+ assert percentage_of_character("python", "m") == 0
+ assert percentage_of_character("ada", "a") == 67
+ assert percentage_of_character("ballerina", "l") == 22
+ assert percentage_of_character("analitik", "k") == 13
+
+
+def test_empty_string() -> None:
+ """Test if function returns 0 for empty string"""
+ assert percentage_of_character("", "a") == 0
+
+
+def test_empty_character() -> None:
+ """Test if function returns 0 for empty character"""
+ assert percentage_of_character("python", "") == 0