def test_feature_vector_construction_after_update(self): TestAuthor.drop_collection() a = TestAuthor() a.screen_name = "ianinegypt" a.tweets = docs1 a.followers_count = 100 a.friends_count = 4 fv = a.update_feature_vector() expected = [0.17948718, 0.05128205, 0.0685413, 0.0512820512, 0.02564102564, 25.] self.assertAlmostEqual(numpy.sum(numpy.array(expected) - numpy.array(fv)), 0) #Then append some new docs a.tweets.extend(docs2) fv = a.update_feature_vector() expected = [0.18604651162790697, 0.11627906976744186, 0.07557117750439367, 0.06976744186046512, 0.06976744186046512, 25.0] self.assertAlmostEqual(numpy.sum(numpy.array(expected) - numpy.array(fv)), 0) TestAuthor.drop_collection()
def test_feature_vector_construction(self): TestAuthor.drop_collection() a = TestAuthor() a.screen_name = "ianinegypt" a.tweets = docs1 a.followers_count = 100 a.friends_count = 4 fv = a.update_feature_vector() expected = [0.17948718, 0.05128205, 0.0685413, 0.0512820512, 0.02564102564, 25.] self.assertAlmostEqual(numpy.sum(numpy.array(expected) - numpy.array(fv)), 0) TestAuthor.drop_collection()