Ejemplo n.º 1
0
 def test_gen_stats_ascii_two_chunk(self):
     teststr = 'the quick brown fox jumps over the lazy dog\n'
     out1 = gen_stats(teststr)
     out2 = gen_stats(teststr)
     combstr = teststr + teststr
     for i in range(128):
         numfound = out1[0][i] + out2[0][i]
         numactual = combstr.count(chr(i))
         self.assertEqual(numactual, numfound)
Ejemplo n.º 2
0
 def test_gen_stats_ascii_two_chunk(self):
     teststr = 'the quick brown fox jumps over the lazy dog\n'
     out1 = gen_stats(teststr)
     out2 = gen_stats(teststr)
     combstr = teststr + teststr
     for i in range(128):
         numfound = out1[0][i] + out2[0][i]
         numactual = combstr.count(chr(i))
         self.assertEqual(numactual, numfound)
Ejemplo n.º 3
0
 def test_get_mode_chars(self):
     teststr = 'the quick brown fox jumps over the lazy dog'
     out = gen_stats(teststr)
     combinedresults = combine_resultsets(out[0].tolist(), out[1])
     modefound = get_mode_chars(combinedresults)
     modeactual = ['o']
     self.assertEqual(modeactual, modefound)
Ejemplo n.º 4
0
 def test_get_num_lines_two_multi(self):
     teststr = 'the quick brown fox\n\f\vjumps over the lazy dog'
     out = gen_stats(teststr)
     numfound = 4
     numactual = teststr.count('\n') + teststr.count('\f') + teststr.count(
         '\v') + 1
     self.assertEqual(numfound, numactual)
Ejemplo n.º 5
0
 def test_get_num_words_two_chunk(self):
     teststr = 'the quick brown fox \n \njumps over the lazy dog'
     out1 = gen_stats(teststr)
     out2 = out1
     numfound = get_num_words(out1[0]) + get_num_words(out2[0])
     numactual = 18
     self.assertEqual(numactual, numfound)
Ejemplo n.º 6
0
 def test_gen_stats_ascii_two_line(self):
     teststr = 'the quick brown fox jumps over the lazy dog\n\nthe quick brown fox jumps over the lazy dog\n'
     out = gen_stats(teststr)
     for i in range(128):
         numfound = out[0][i]
         numactual = teststr.count(chr(i))
         self.assertEqual(numactual, numfound)
Ejemplo n.º 7
0
 def test_gen_stats_ascii_two_line(self):
     teststr = 'the quick brown fox jumps over the lazy dog\n\nthe quick brown fox jumps over the lazy dog\n'
     out = gen_stats(teststr)
     for i in range(128):
         numfound = out[0][i]
         numactual = teststr.count(chr(i))
         self.assertEqual(numactual, numfound)
Ejemplo n.º 8
0
 def test_gen_stats_utf_simple(self):
     # trad chinese quick brown.... fyi
     teststr = u'快速的棕色狐狸跳過懶狗'
     out = gen_stats(teststr)
     for char in teststr:
         numfound = out[1][char]
         numactual = teststr.count(char)
         self.assertEqual(numactual, numfound)
Ejemplo n.º 9
0
 def test_gen_stats_utf_simple(self):
     # trad chinese quick brown.... fyi
     teststr = u'快速的棕色狐狸跳過懶狗'
     out = gen_stats(teststr)
     for char in teststr:
         numfound = out[1][char]
         numactual = teststr.count(char)
         self.assertEqual(numactual, numfound)
Ejemplo n.º 10
0
 def test_get_num_lines_two(self):
     teststr = 'the quick brown fox\njumps over the lazy dog'
     out = gen_stats(teststr)
     numfound = get_num_lines(out[0])
     numactual = 2
     self.assertEqual(numfound, numactual)
Ejemplo n.º 11
0
 def test_get_num_words_double_newline(self):
     teststr = 'the quick brown fox \n \njumps over the lazy dog'
     out = gen_stats(teststr)
     numfound = get_num_words(out[0])
     numactual = 9
     self.assertEqual(numactual, numfound)
Ejemplo n.º 12
0
 def test_get_num_words(self):
     teststr = 'the quick brown fox jumps over the lazy dog'
     out1 = gen_stats(teststr)
     numfound = get_num_words(out1[0])
     numactual = 9
     self.assertEqual(numactual, numfound)