Skip to content

Commit

Permalink
Update test_alphanumeric.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 14, 2024
1 parent df3de08 commit b98e626
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions kyu_5/not_very_secure/test_alphanumeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import unittest
import allure
from parameterized import parameterized
from utils.log_func import print_log
from kyu_5.not_very_secure.alphanumeric import alphanumeric

Expand All @@ -34,7 +35,11 @@
class AlphanumericTestCase(unittest.TestCase):
"""Testing alphanumeric function."""

def test_alphanumeric(self):
@parameterized.expand([
("hello world_", False),
("PassW0rd", True),
(" ", False)])
def test_alphanumeric(self, password, expected):
"""
Testing alphanumeric function with various test inputs.
Expand All @@ -59,14 +64,5 @@ def test_alphanumeric(self):
"<p></p>")
# pylint: enable-msg=R0801
with allure.step("Enter test string and verify the output"):
test_data: tuple = (
("hello world_", False),
("PassW0rd", True),
(" ", False))

for password, expected in test_data:
print_log(password=password,
expected=expected)

self.assertEqual(expected,
alphanumeric(password))
print_log(password=password, expected=expected)
self.assertEqual(expected, alphanumeric(password))

0 comments on commit b98e626

Please sign in to comment.