def test_count_words(self):
     self.assertEqual(count_words(["apple", "banana", "apple", "pie"]), 
         {'apple': 2, 'pie': 1, 'banana': 1})
     self.assertEqual(count_words(["python", "python", "python", "ruby"]), 
         {'ruby': 1, 'python': 3})
     self.assertEqual(count_words(["book", "pen", "pen", "", "book", "list", "book"]),
         {'book': 3, 'pen': 2, '': 1, 'list': 1})
예제 #2
0
 def test_count_words(self):
     expected1 = {'apple': 2, 'pie': 1, 'banana': 1}
     self.assertEqual(expected1, solution.count_words(["apple", \
         "banana", "apple", "pie"]))
     expected2 = {'ruby': 1, 'python': 3}
     self.assertEqual(expected2, solution.count_words(["python",\
      "python", "python", "ruby"]))
 def test_count_words(self):
     self.assertEqual({
         'apple': 2,
         'pie': 1,
         'banana': 1
     }, solution.count_words(['apple', 'banana', 'apple', 'pie']))
     self.assertEqual({
         'ruby': 1,
         'python': 3
     }, solution.count_words(["python", "python", "python", "ruby"]))
예제 #4
0
 def test_problem_statement_cases(self):
     self.assertEqual({
         'apple': 2,
         'pie': 1,
         'banana': 1
     }, count_words(["apple", "banana", "apple", "pie"]))
     self.assertEqual({
         'ruby': 1,
         'python': 3
     }, count_words(["python", "python", "python", "ruby"]))
예제 #5
0
 def test_count_words(self):
     self.assertDictEqual({
         'apple': 2,
         'pie': 1,
         'banana': 1
     }, count_words(["apple", "banana", "apple", "pie"]))
     self.assertDictEqual({
         'ruby': 1,
         'python': 3
     }, count_words(["python", "python", "python", "ruby"]))
 def test_count_words(self):
     self.assertEqual(count_words(["apple", "banana", "apple", "pie"]), {
         'apple': 2,
         'pie': 1,
         'banana': 1
     })
     self.assertEqual(count_words(["python", "python", "python", "ruby"]), {
         'ruby': 1,
         'python': 3
     })
     self.assertEqual(
         count_words(["book", "pen", "pen", "", "book", "list", "book"]), {
             'book': 3,
             'pen': 2,
             '': 1,
             'list': 1
         })
예제 #7
0
def test_count_words_multiple_words():
    # Testing combinations of 2 words.
    for word1 in TEXT_1_COUNT:
        for word2 in TEXT_1_COUNT:
            if word1 != word2:
                count1 = TEXT_1_COUNT[word1]
                count2 = TEXT_1_COUNT[word2]
                assert (count1 + count2) == count_words([word1, word2], TEXT_1)
예제 #8
0
 def test_count_words(self):
     sys.argv.append("words")
     sys.argv.append("story")
     command = sys.argv[1]
     file_to_open = sys.argv[2]
     file_open = open(file_to_open, "r")
     contents = file_open.read().split(" ")
     expect = len(contents) + 2
     self.assertEqual(expect, solution.count_words(file_to_open))
     file_open.close()
예제 #9
0
 def test_count_words(self):
     self.assertEqual({'apple': 2, 'pie': 1, 'banana': 1},solution.count_words(['apple', 'banana', 'apple', 'pie']))
     self.assertEqual({'ruby': 1, 'python': 3}, solution.count_words(['python', 'python', 'python', 'ruby']))
예제 #10
0
    def test_count_words(self):
        res1 = {'banana': 1, 'pie': 1, 'apple': 2}
        res2 = {'python': 3, 'ruby': 1}

        self.assertEqual(res1, count_words(["apple", "banana", "apple", "pie"]))
        self.assertEqual(res2, count_words(["python", "python", "python", "ruby"]))
예제 #11
0
 def test_count_words(self):
     self.assertEqual(166, count_words(self.filename))
예제 #12
0
 def test_count_words5(self):
     self.assertEqual({1: 4, 3: 1, 6: 1}, solution.count_words([1, 1, 3, 1, 1, 6]))
예제 #13
0
def test_count_words_single_words():
    # Testing single word counts.
    for word in TEXT_1_COUNT:
        count = TEXT_1_COUNT[word]
        assert count == count_words([word], TEXT_1)
예제 #14
0
 def test_count_words2(self):
     self.assertEqual({'': 1}, solution.count_words(['']))
예제 #15
0
 def test_count_words5(self):
     self.assertEqual({
         1: 4,
         3: 1,
         6: 1
     }, solution.count_words([1, 1, 3, 1, 1, 6]))
예제 #16
0
 def test(self):
     self.assertEqual(1, solution.count_lines(self.filename))
     self.assertEqual(2, solution.count_words(self.filename))
     self.assertEqual(10, solution.count_chars(self.filename))
예제 #17
0
 def test_count_words(self):
     self.assertEqual({ "apple": 2, "banana": 1, "pie": 1 },
         count_words(["apple", "banana", "apple", "pie"]))
     self.assertEqual({ "python": 3, "ruby": 1 },
         count_words(["python", "python", "python", "ruby"]))
예제 #18
0
 def test_one(self):
     self.assertEquals(count_words(["apple", "banana", "apple", "pie"]), {
         'apple': 2,
         'pie': 1,
         'banana': 1
     })
예제 #19
0
 def test_two(self):
     self.assertEquals(count_words(["python", "python", "python", "ruby"]),
                       {
                           'ruby': 1,
                           'python': 3
                       })
예제 #20
0
 def test_count_words2(self):
     self.assertEqual({'': 1}, solution.count_words(['']))
예제 #21
0
 def test_count_words1(self):
     self.assertEqual({'python': 3}, solution.count_words(['python', 'python', 'python']))
예제 #22
0
 def test_count_words3(self):
     self.assertEqual({
         'banana': 1,
         'apple': 2,
         'pie': 1
     }, solution.count_words(["apple", "banana", "apple", "pie"]))
예제 #23
0
 def test_counting_words2(self):
     self.assertEqual({"python": 3, "ruby": 1}, solution.count_words(["python", "python", "python", "ruby"]))
예제 #24
0
 def test_count_words4(self):
     self.assertEqual({
         'aa': 1,
         'bb': 1,
         'cc': 1
     }, solution.count_words(['aa', 'bb', 'cc']))
예제 #25
0
 def test_1(self):
     self.assertEqual({'apple': 2, 'pie': 1, 'banana': 1}, solution.count_words(["apple", "banana", "apple", "pie"]))
예제 #26
0
 def test_count_words1(self):
     self.assertEqual({'python': 3},
                      solution.count_words(['python', 'python', 'python']))
예제 #27
0
 def test_count_words(self):
     self.assertEqual({'apple': 2, 'pie': 1, 'banana': 1}, count_words(["apple", "banana", "apple", "pie"]))
     self.assertEqual({'ruby': 1, 'python': 3}, count_words(["python", "python", "python", "ruby"]))
     self.assertEqual({'hackbg': 2}, count_words(["hackbg", "hackbg"]))
예제 #28
0
 def test_count_words_2(self):
     self.assertEqual({
         'ruby': 1,
         'python': 3
     }, solution.count_words(["python", "python", "python", "ruby"]))
예제 #29
0
파일: test.py 프로젝트: gshopov/the-stash
 def test_with_empty_list(self):
     self.assertEqual(solution.count_words([]), {})
예제 #30
0
	def test_some_arrays(self):
		self.assertEqual({'apple': 2, 'pie': 1, 'banana': 1},count_words(["apple", "banana", "apple", "pie"]))
		self.assertEqual({'ruby': 1, 'python': 3},count_words(["python", "python", "python", "ruby"]))
예제 #31
0
 def test_count_words4(self):
     self.assertEqual({'aa': 1, 'bb': 1, 'cc': 1}, solution.count_words(['aa', 'bb', 'cc']))
예제 #32
0
 def test_counting_words1(self):
     self.assertEqual({"apple": 2, "banana": 1, "pie": 1}, solution.count_words(["apple", "banana", "apple", "pie"]))
예제 #33
0
 def test_problem_statement_cases(self):
     self.assertEqual({'apple': 2, 'pie': 1, 'banana': 1}, count_words(["apple", "banana", "apple", "pie"]))
     self.assertEqual({'ruby': 1, 'python': 3}, count_words(["python", "python", "python", "ruby"]))
예제 #34
0
 def test0(self):
     result = count_words(["apple", "banana", "apple", "pie"])
     self.assertEqual(result, count_words(["apple", "banana", "apple", "pie"]))
예제 #35
0
파일: test.py 프로젝트: h3lgi/HackBulgaria
	def test_count_words_2(self):
		self.assertEqual({'helgi': 1, 'murarius': 1}, count_words(["helgi", "murarius"]))
예제 #36
0
 def test_2(self):
     self.assertEqual({'ruby': 1, 'python': 3}, solution.count_words(["python", "python", "python", "ruby"]))
예제 #37
0
파일: test.py 프로젝트: h3lgi/HackBulgaria
	def test_count_words_0(self):
		self.assertEqual({'apple': 2, 'pie': 1, 'banana': 1}, count_words(["apple", "banana", "apple", "pie"]))
예제 #38
0
파일: test.py 프로젝트: gshopov/the-stash
 def test_with_repearing_words(self):
     self.assertEqual(solution.count_words(['python', 'love', 'i', 'ruby',
                                            'fmi', 'hate', 'i', 'love']),
                      {'python': 1, 'love': 2, 'i': 2, 'ruby': 1, 'fmi': 1,
                       'hate': 1})
예제 #39
0
파일: test.py 프로젝트: h3lgi/HackBulgaria
	def test_count_words_1(self):
		self.assertEqual({'ruby': 1, 'python': 3}, count_words(["python", "python", "python", "ruby"]))
예제 #40
0
파일: test.py 프로젝트: gshopov/the-stash
 def test_with_unique_words(self):
     self.assertEqual(solution.count_words(['python', 'ruby', 'hack']),
                      {'python': 1, 'ruby': 1, 'hack': 1})
예제 #41
0
 def test_count_words(self):
     expected1 = {"apple": 2, "pie": 1, "banana": 1}
     self.assertEqual(expected1, solution.count_words(["apple", "banana", "apple", "pie"]))
     expected2 = {"ruby": 1, "python": 3}
     self.assertEqual(expected2, solution.count_words(["python", "python", "python", "ruby"]))