示例#1
0
    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)
示例#2
0
 def test_true(self):
     self.assertEqual(
         wordcount.wordCount(
             "The Quick Brown Fox Jumped Over the Lazy Dog"), 9)
示例#3
0
 def test_false3(self):
     self.assertEqual(wordcount.wordCount(""), 1)
示例#4
0
def test_word_count():
    assert wordcount.wordCount("Yellow dogs are cool") == 4
示例#5
0
 def test_5words(self):
     self.assertEqual(wordcount.wordCount("I like to eat cheese"), 5)
示例#6
0
def test_spaces_only():
    values = ("    ")
    val = wordcount.wordCount(values)
    assert val == 0
示例#7
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"))
示例#9
0
 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
示例#13
0
def test_capitals():
    assert wordcount.wordCount("HELLO I AM JEFF") == wordcount.wordCount("hello i am jeff")
示例#14
0
def test_spaces():
    assert wordcount.wordCount("helloIamaCoolmanNamedJerry") == wordcount.wordCount("Hello")
示例#15
0
 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"))
示例#17
0
 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)
示例#19
0
 def test_true2(self):
     self.assertEqual(wordcount.wordCount("Hello World"), 2)
示例#20
0
def test_5words():
    values = ("I like to eat cheese")
    val = wordcount.wordCount(values)
    assert val == 5
示例#21
0
 def test_true3(self):
     self.assertEqual(wordcount.wordCount(""), 0)
示例#22
0
 def test_double_spaces(self):
     self.assertEqual(wordcount.wordCount("It  was  sunny  today"), 4)
示例#23
0
 def test_false2(self):
     self.assertEqual(wordcount.wordCount("Hello World"), 9)
示例#24
0
 def test_spaces_only(self):
     self.assertEqual(wordcount.wordCount("    "), 0)
示例#25
0
def test_wordCountZero():
    assert wordcount.wordCount("                   ") == 0