Esempio n. 1
0
    def test_db_connection(self):
        """ That the proper connection is used when we use psycopg2 or sqlite3. You'll need to manually change your settings.py"""
        db = get_bayes_db()
        bfilter = Hammie(db,'w')

        #is spam
        self.train_it(bfilter)
        prob, result = bfilter.score_and_filter(msg=self.spam2)
        self.assertTrue(prob > 0.9)

        # not spam
        prob, result = bfilter.score_and_filter(msg='Very nice! According to that website the lot size is 3.80 Acres ? That cant be right... Anyway Tiffany is also sick! No vomiting but lots of tummy related issues. Maybe its something they ate?')
        self.assertTrue(prob < 0.01)