kyu_5.the_hashtag_generator package

Submodules

kyu_5.the_hashtag_generator.hashtag_generator module

Solution for -> The Hashtag Generator.

Created by Egor Kostan. GitHub: https://github.com/ikostan

kyu_5.the_hashtag_generator.hashtag_generator.generate_hashtag(word: str) bool | str[source]

Hashtag Generator.

  1. It must start with a hashtag (#).

  2. All words must have their first letter capitalized.

  3. If final result is longer than 140 chars it must return false.

  4. Input or result must return false when empty.

Parameters:

word – str

Returns:

kyu_5.the_hashtag_generator.test_generate_hashtag module

Test for -> ‘generate_hashtag’ function.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_5.the_hashtag_generator.test_generate_hashtag.GenerateHashtagTestCase(methodName='runTest')[source]

Bases: TestCase

Testing generate_hashtag function.

_classSetupFailed = False
_class_cleanups = []
test_generate_hashtag = None
test_generate_hashtag_0_(**kw)

Testing ‘generate_hashtag’ function with various test data [with string=’’, expected=False, message=’Expected an empty string to return False’].

Returns:

test_generate_hashtag_1_Codewars(**kw)

Testing ‘generate_hashtag’ function with various test data [with string=’Codewars’, expected=’#Codewars’, message=’Should handle a single word.’].

Returns:

test_generate_hashtag_2_Codewars_(**kw)

Testing ‘generate_hashtag’ function with various test data [with string=’Codewars ‘, expected=’#Codewars’, message=’Should handle trailing whitespace.’].

Returns:

test_generate_hashtag_3_Codewars_Is_Nice(**kw)

Testing ‘generate_hashtag’ function with various test data [with string=’Codewars Is Nice’, expected=’#CodewarsIsNice’, message=’Should remove spaces.’].

Returns:

test_generate_hashtag_4_codewars_is_nice(**kw)

Testing ‘generate_hashtag’ function with various test data [with string=’codewars is nice’, expected=’#CodewarsIsNice’, message=’Should capitalize first letters of words.’].

Returns:

test_generate_hashtag_5_CodeWars_is_nice(**kw)

Testing ‘generate_hashtag’ function with various test data [with string=’CodeWars is nice’, expected=’#CodewarsIsNice’, message=’Should capitalize all letters o… all lower case but the first.’].

Returns:

test_generate_hashtag_6_c_i_n(**kw)

Testing ‘generate_hashtag’ function with various test data [with string=’c i n’, expected=’#CIN’, message=’Should capitalize first letters… when single letters.’].

Returns:

test_generate_hashtag_7_codewars_is_nice(**kw)

Testing ‘generate_hashtag’ function with various test data [with string=’codewars is nice’, expected=’#CodewarsIsNice’, message=’Should deal with unnecessary middle spaces.’].

Returns:

test_generate_hashtag_8_Loooooooooooooooooooooooooooooooooooo_oooooooooooooooooooooooooooooooooooooo_oooooooooooooooooooooooooooooooooooooo_ooooooooooooooooooooooooooooooooooooo_oooooong_Cat(**kw)

Testing ‘generate_hashtag’ function with various test data [with string=’Loooooooooooooooooooooooooooooo…ooooooooo oooooong Cat’, expected=False, message=’Should return False if the fina… longer than 140 chars.’].

Returns:

Module contents

The Hashtag Generator.