Exemple #1
0
def main():

	summary = {}

	filenames = open_several_files(files)

	for filename in filenames:
		text = read_file(filename)
		count = word_counter(text)
		genderedwords = both_genders(text)

		# store the report in the dictionary for each hint: add keys and nested dictionsaries
	pass
Exemple #2
0
        self.assertEqual(ratio, 2)
        self.assertEqual(ratio, 2.0)
        self.assertEqual(type(ratio), type(1.0))

    def test_word_counter(self):
        count = word_counter(self.text)
        self.assertIsInstance(count, dict)
        self.assertEqual(count["was"], 5)
        self.assertEqual(len(count), 27)

    # def test_both_genders(self):
    #     pass


class TestFixtures(TestBase):
    def test_fixture(self):
        self.fixture = range(1, 11)
        self.assertEqual(self.fixture, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])


class TestOpenFiles(TestBase):
    def test_open_files(self):
        self.assertEqual(self.files, ["frank_text.txt", "dr_JEKYLL.txt"])
        self.assertNotEqual(self.files, ["frank_text.txt", "_JEKYLL.txt"])


if __name__ == "__main__":
    print "hello"

    print len(word_counter(text))
Exemple #3
0
 def test_word_counter(self):
     count = word_counter(self.text)
     self.assertIsInstance(count, dict)
     self.assertEqual(count["was"], 5)
     self.assertEqual(len(count), 27)
Exemple #4
0
def test_counting_words(text):
    text = test_removing_punctuation(text)
    word_dict = word_counter(text)
    return sum(word_dict.itervalues())