def test_word_occurance5(self):
     print(words('testing 1 2 testing'))
     self.assertDictEqual(
         {'testing': 2, 1: 1, 2: 1},
         words('testing 1 2 testing'),
         msg='should include numbers'
     )
Ejemplo n.º 2
0
 def test_word_occurance5(self):
     print(words('testing 1 2 testing'))
     self.assertDictEqual({
         'testing': 2,
         1: 1,
         2: 1
     },
                          words('testing 1 2 testing'),
                          msg='should include numbers')
Ejemplo n.º 3
0
 def test_word_occurance9(self):
     self.assertDictEqual({
         'hello': 1,
         'world': 1
     },
                          words('hello\tworld'),
                          msg='should not count tabs')
Ejemplo n.º 4
0
 def test_word_occurance8(self):
     self.assertDictEqual({
         'hello': 1,
         'world': 1
     },
                          words('hello\nworld'),
                          msg='should not count multilines')
Ejemplo n.º 5
0
 def test_word_occurance0(self):
     self.assertDictEqual({
         'hello': 1,
         'world': 1
     },
                          words('hello  world'),
                          msg='should count multiple spaces as one')
Ejemplo n.º 6
0
 def test_word_occurance2(self):
     self.assertDictEqual({
         'one': 1,
         'of': 1,
         'each': 1
     },
                          words("one of each"),
                          msg='should count one of each')
Ejemplo n.º 7
0
 def test_word_occurance6(self):
     self.assertDictEqual({
         'go': 1,
         'Go': 1,
         'GO': 1
     },
                          words('go Go GO'),
                          msg='should respect case')
Ejemplo n.º 8
0
 def test_word_occurance7(self):
     self.assertDictEqual(
         {
             "¡Hola!": 1,
             "¿Qué": 1,
             "tal?": 1,
             "Привет!": 1
         },
         words('¡Hola! ¿Qué tal? Привет!'),
         msg='should count international characters properly')
Ejemplo n.º 9
0
 def test_word_occurance3(self):
     self.assertDictEqual(
         {
             'one': 1,
             'fish': 4,
             'two': 1,
             'red': 1,
             'blue': 1
         },
         words("one fish two fish red fish blue fish"),
         msg='should count multiple occurrences')
Ejemplo n.º 10
0
 def test_word_occurance4(self):
     self.assertDictEqual(
         {'car': 1,
             ":": 2,
             'carpet': 1,
             'as': 1,
             'java': 1,
             'javascript!!&@$%^&': 1
          },
         words('car : carpet as java : javascript!!&@$%^&'),
         msg='should include punctuation'
     )
Ejemplo n.º 11
0
 def test_word_occurance4(self):
     self.assertDictEqual(
         {
             'car': 1,
             ":": 2,
             'carpet': 1,
             'as': 1,
             'java': 1,
             'javascript!!&@$%^&': 1
         },
         words('car : carpet as java : javascript!!&@$%^&'),
         msg='should include punctuation')
Ejemplo n.º 12
0
 def test_word_occurance6(self):
     self.assertDictEqual(
         {'go': 1, 'Go': 1, 'GO': 1},
         words('go Go GO'),
         msg='should respect case'
     )
Ejemplo n.º 13
0
 def test_word_occurance3(self):
     self.assertDictEqual(
         {'one': 1, 'fish': 4, 'two': 1, 'red': 1, 'blue': 1},
         words("one fish two fish red fish blue fish"),
         msg='should count multiple occurrences'
     )
Ejemplo n.º 14
0
 def test_word_occurance2(self):
     self.assertDictEqual(
         {'one': 1, 'of': 1, 'each': 1},
         words("one of each"),
         msg='should count one of each'
     )
Ejemplo n.º 15
0
 def test_word_occurance9(self):
     self.assertDictEqual(
         {'hello': 1, 'world': 1},
         words('hello\tworld'),
         msg='should not count tabs'
     )
Ejemplo n.º 16
0
 def test_word_occurance7(self):
     self.assertDictEqual(
         {"¡Hola!": 1, "¿Qué": 1, "tal?": 1, "Привет!": 1},
         words('¡Hola! ¿Qué tal? Привет!'),
         msg='should count international characters properly'
     )
Ejemplo n.º 17
0
 def test_word_occurance8(self):
     self.assertDictEqual(
         {'hello': 1, 'world': 1},
         words('hello\nworld'),
         msg='should not count multilines'
     )
Ejemplo n.º 18
0
 def test_word_occurance1(self):
     self.assertDictEqual(
         {'word': 1},
         words('word'),
         msg='should count one word'
     )
Ejemplo n.º 19
0
 def test_word_occurance0(self):
     self.assertDictEqual(
         {'hello': 1, 'world': 1},
         words('hello  world'),
         msg='should count multiple spaces as one'
     )
Ejemplo n.º 20
0
 def test_word_occurance1(self):
     self.assertDictEqual({'word': 1},
                          words('word'),
                          msg='should count one word')