def test_wordcount(self): print(" === testing wordcounts ") print(" testing 'i am homeless' ") text = "i am homeless" num = wordcount.wordCount(text) self.assertEqual(num, 3) print(" testing ' i think i need to do something about my test cases'") text = "i think i need to do something about my test cases" num = wordcount.wordCount(text) self.assertEqual(num, 11) print(" testing: 0 0 0 0 0 0 0 0 0 0 0 0 ") text = "0 0 0 0 0 0 0 0 0 0 0 0" num = wordcount.wordCount(text) self.assertEqual(num, 12) print(" testing: ' '") text = " " num = wordcount.wordCount(text) self.assertEqual(num, 0)
def test_true(self): self.assertEqual( wordcount.wordCount( "The Quick Brown Fox Jumped Over the Lazy Dog"), 9)
def test_false3(self): self.assertEqual(wordcount.wordCount(""), 1)
def test_word_count(): assert wordcount.wordCount("Yellow dogs are cool") == 4
def test_5words(self): self.assertEqual(wordcount.wordCount("I like to eat cheese"), 5)
def test_spaces_only(): values = (" ") val = wordcount.wordCount(values) assert val == 0
def test_double_spaces(): values = ("It was sunny today") val = wordcount.wordCount(values) assert val == 4
def test_Spaces(self): self.assertEqual( wordcount.wordCount("thequickbrownfoxjumpsoverthebridge"), wordcount.wordCount("yes"))
def test_invalidInput(self): #invalid data type should return a -1 self.assertEqual(wordcount.wordCount(1), -1)
def test_unsuccessful_wordcount(): assert wordcount.wordCount("oneWord") != 1
def test_successful_empty_word(): assert wordcount.wordCount("") == 0
def test_successful_wordcount(): assert wordcount.wordCount("oneword twoword,stilltwo,stilltwo-two threeword") == 3
def test_capitals(): assert wordcount.wordCount("HELLO I AM JEFF") == wordcount.wordCount("hello i am jeff")
def test_spaces(): assert wordcount.wordCount("helloIamaCoolmanNamedJerry") == wordcount.wordCount("Hello")
def test_empty(self): #Empty string should have 0 words self.assertEqual(wordcount.wordCount(""), 0)
def test_NotNull(self): self.assertIsNotNone( wordcount.wordCount("the quick brown fox jumps over the bridge"))
def test_regular(self): #Testing with a normal string self.assertEqual( wordcount.wordCount("word1 word2,word2still word3 word4 word5"), 5)
def test_Equals(self): self.assertEqual( wordcount.wordCount("the quick brown fox jumps over the bridge"), 8)
def test_true2(self): self.assertEqual(wordcount.wordCount("Hello World"), 2)
def test_5words(): values = ("I like to eat cheese") val = wordcount.wordCount(values) assert val == 5
def test_true3(self): self.assertEqual(wordcount.wordCount(""), 0)
def test_double_spaces(self): self.assertEqual(wordcount.wordCount("It was sunny today"), 4)
def test_false2(self): self.assertEqual(wordcount.wordCount("Hello World"), 9)
def test_spaces_only(self): self.assertEqual(wordcount.wordCount(" "), 0)
def test_wordCountZero(): assert wordcount.wordCount(" ") == 0