def test_camelcase_sentence(self): self.assertEqual('helloWorld', camelCase.camel_case('Hello World')) self.assertEqual('', camelCase.camel_case('')) self.assertEqual('!~@%^&*:><', camelCase.camel_case('!~ @%^ &*:><')) self.assertEqual('helloWorld', camelCase.camel_case(' hello World ')) self.assertEqual('', camelCase.camel_case(' '))
def test_camelcase_sentence(self): #arrange #action #assert self.assertEqual('helloWorld', camelCase.camel_case('Hello World')) self.assertEqual('', camelCase.camel_case('')) self.assertEqual('helloWorld', camelCase.camel_case(' Hello World ')) self.assertEqual('🙃🙃', camelCase.camel_case(' 🙃 🙃 '))
def test_camel_case_gamzee_time(self): sentence = 'ThIs Is A tOtAlLy NoRmAl SeNtEnCe.' expected_output = 'thisIsATotallyNormalSentence.' actual_output = camelCase.camel_case(sentence) self.assertEqual(actual_output, expected_output)
def test_camel_case_tab_break(self): sentence = 'This is a totally \tnormal sentence.' expected_output = 'thisIsATotallyNormalSentence.' actual_output = camelCase.camel_case(sentence) self.assertEqual(actual_output, expected_output)
def test_camel_case_trailing_spaces(self): sentence = 'This is a totally normal sentence .' expected_output = 'thisIsATotallyNormalSentence.' actual_output = camelCase.camel_case(sentence) self.assertEqual(actual_output, expected_output)
def test_camel_case_working(self): #testing if the function turns the sentence into camelCase sentence_example = 'ILikeBread' expected_result = 'iLikeBread' self.assertEqual(expected_result, camelCase.camel_case(sentence_example))
def test_camel_case_emoji(self): sentence = '🔴 🟠🟡 🟢 🔵 🟣 🟤 🟥 🟧 🟨 🟩 🟦 🟪 🟫.' expected_output = '🔴🟠🟡🟢🔵🟣🟤🟥🟧🟨🟩🟦🟪🟫.' actual_output = camelCase.camel_case(sentence) self.assertEqual(actual_output, expected_output)
def test_strings_with_newline_or_tab(self): input_and_expected_outputs = { '\tThere is a \t tab here': 'thereIsATabHere', 'There is a \n newline here\n': 'thereIsANewlineHere' } for input_val, output_val in input_and_expected_outputs.items(): self.assertEqual(output_val, camelCase.camel_case(input_val))
def test_strings_with_whitespace(self): input_and_expected_outputs = { ' Spaces Before': 'spacesBefore', 'Spaces after ': 'spacesAfter', ' Spaces all over ': 'spacesAllOver', } for input_val, output_val in input_and_expected_outputs.items(): self.assertEqual(output_val, camelCase.camel_case(input_val))
def test_camel_case_weird_characters(self): sentence = ' Th¤s is a tötall¥ normal ƒentence.' expected_output = 'th¤sIsATötall¥NormalƑentence.' #Apparently 'ƒ' has an upper case varient. Who knew? actual_output = camelCase.camel_case(sentence) self.assertEqual(actual_output, expected_output)
def test_camelcase_sentence(self): self.assertEqual('ohSayCanYouSee', camelCase.camel_case('OH SAY CAN YOU SEE')) self.assertEqual('', camelCase.camel_case('')) self.assertEqual('!@#$%^&*()', camelCase.camel_case('!@#$%^&*()')) self.assertEqual('helloWorld', camelCase.camel_case(' HELLO WORLD ')) self.assertEqual('helloFromPlanetNeptune', camelCase.camel_case('HELLO FROM \n PLANET NEPTUNE')) self.assertEqual('superAwesomeNintendoGame', camelCase.camel_case('SUPER AWESOME NINTENDO GAME'))
def test_camelcase_with_one_word(self): self.assertEqual('hello', camelCase.camel_case('Hello'))
def test_camelcase_with_numbers(self): self.assertEqual('happy2SeeYou', camelCase.camel_case('Happy 2 See You'))
def test_blank_or_empty(self): self.assertEqual('', camelCase.camel_case('')) self.assertEqual('', camelCase.camel_case(' '))
def test_camelcase_scentence(self): self.assertEqual('helloWorld', camelCase.camel_case('Hello World')) self.assertEqual('', camelCase.camel_case('')) self.assertEqual('', camelCase.camel_case('123This'))
def test_if_left_blank(self): bad_string = '' result = camelCase.camel_case(bad_string) self.assertTrue(result)
def test_camelCase_with_spaces(self): self.assertEqual('sentenceWithSpaces', camelCase.camel_case(' Sentence With Spaces '))
def test_camelcase_sentence(self): self.assertEqual('helloWorld', camelCase.camel_case('Hello World')) self.assertEqual('helloWorld', camelCase.camel_case('hello world')) self.assertEqual('helloWorld', camelCase.camel_case('HelLo WoRlD'))
def test_numbers_or_punctuation(self): self.assertEqual('helloWorld', camelCase.camel_case('#hello world$#')) self.assertEqual('helloWorld', camelCase.camel_case('()#@hello%^ world')) self.assertEqual('helloWorld', camelCase.camel_case('hello wor$ld')) self.assertEqual('helloWorld', camelCase.camel_case('hel^lo wor#@ld'))
def test_single_word(self): self.assertEqual('camel', camelCase.camel_case('camel'))
def test_camelcase_longer_sentence(self): self.assertEqual('thisIsANewTest', camelCase.camel_case('This Is A New Test'))
def test_a_single_word_used(self): bad_string = 'word' result = camelCase.camel_case(bad_string) self.assertFalse(result)