Beispiel #1
0
 def test_should_throw_exception_when_filename_is_empty(self):
     with self.assertRaises(ValueError):
         f_find_words("", "lorem")
Beispiel #2
0
 def test_should_throw_exception_when_filename_has_invalid_name(self):
     with self.assertRaises(ValueError):
         f_find_words("l&ore#m-ips$um.tx#t", "lorem")
Beispiel #3
0
 def test_should_throw_exception_when_file_does_not_exists(self):
     with self.assertRaises(ValueError):
         f_find_words("non-existing-file", "car", "bike", "cloud")
Beispiel #4
0
 def test_should_throw_exception_when_no_keywords_are_provided(self):
     with self.assertRaises(ValueError):
         f_find_words("lorem-ipsum.txt")
Beispiel #5
0
    def test_find_word_ocurrences_in_existing_file(self):
        keywords = f_find_words("lorem-ipsum.txt", "lorem", "Lorem", "et")

        self.assertDictEqual(d1=keywords, d2={'lorem': 3, 'Lorem': 2, 'et': 5})