def test_word(self): word = Word("test") self.assertEqual(word.getName(), "test") word.setTF(0.4) word.setIDF(0.6) self.assertEqual(word.getTF(), 0.4) self.assertEqual(word.getIDF(), 0.6)
def test_document(self): word = Word("test") word.setTF(0.4) word.setIDF(0.6) doc = Document("hello my name is") self.assertEqual(doc.getDocString(), "hello my name is") doc.addRealWord(word) self.assertEqual(doc.getWordDict().get("test").getName(), "test") self.assertTrue(doc.hasWord("test"))