Skip to content

Commit

Permalink
Update test_generate_hashtag.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 14, 2024
1 parent 4ddc7c7 commit 759acb0
Showing 1 changed file with 36 additions and 37 deletions.
73 changes: 36 additions & 37 deletions kyu_5/the_hashtag_generator/test_generate_hashtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,40 +33,39 @@ class GenerateHashtagTestCase(unittest.TestCase):

@parameterized.expand(
[('',
False,
'Expected an empty string to return False'),
('Codewars',
'#Codewars',
'Should handle a single word.'),
('Codewars ',
'#Codewars',
'Should handle trailing whitespace.'),
('Codewars Is Nice',
'#CodewarsIsNice',
'Should remove spaces.'),
('codewars is nice',
'#CodewarsIsNice',
'Should capitalize first letters of words.'),
('CodeWars is nice',
'#CodewarsIsNice',
'Should capitalize all letters of words - '
'all lower case but the first.'),
('c i n',
'#CIN',
'Should capitalize first letters of words even '
'when single letters.'),
('codewars is nice',
'#CodewarsIsNice',
'Should deal with unnecessary middle spaces.'),
('Loooooooooooooooooooooooooooooooooooo'
'oooooooooooooooooooooooooooooooooooooo'
'oooooooooooooooooooooooooooooooooooooo'
'ooooooooooooooooooooooooooooooooooooo'
'oooooong Cat',
False,
'Should return False if the final word is '
'longer than 140 chars.')]
)
False,
'Expected an empty string to return False'),
('Codewars',
'#Codewars',
'Should handle a single word.'),
('Codewars ',
'#Codewars',
'Should handle trailing whitespace.'),
('Codewars Is Nice',
'#CodewarsIsNice',
'Should remove spaces.'),
('codewars is nice',
'#CodewarsIsNice',
'Should capitalize first letters of words.'),
('CodeWars is nice',
'#CodewarsIsNice',
'Should capitalize all letters of words - '
'all lower case but the first.'),
('c i n',
'#CIN',
'Should capitalize first letters of words even '
'when single letters.'),
('codewars is nice',
'#CodewarsIsNice',
'Should deal with unnecessary middle spaces.'),
('Loooooooooooooooooooooooooooooooooooo'
'oooooooooooooooooooooooooooooooooooooo'
'oooooooooooooooooooooooooooooooooooooo'
'ooooooooooooooooooooooooooooooooooooo'
'oooooong Cat',
False,
'Should return False if the final word is '
'longer than 140 chars.')])
def test_generate_hashtag(self, string, expected, message):
"""
Testing 'generate_hashtag' function with various test data.
Expand Down Expand Up @@ -95,7 +94,7 @@ def test_generate_hashtag(self, string, expected, message):
with allure.step("Enter a test string and verify the output:"):
actual_result = generate_hashtag(string)
print_log(string=string,
message=message,
expected=expected,
actual_result=actual_result)
message=message,
expected=expected,
actual_result=actual_result)
self.assertEqual(expected, actual_result, message)

0 comments on commit 759acb0

Please sign in to comment.