コード例 #1
0
 def setUp(self):
     try:
         self.__mongoUtils = MongoSaveUtils(HOST, PORT, USR, PWD, DB, FC_N,
                                            FC_DN, MDN)
         self.calcMongo = CalcMongo()
     except ConnectionFailure as e:
         pass
コード例 #2
0
 def setUp(self):
     self.__mongoUtils = MongoSaveUtils(HOST, PORT, USR, PWD, DB, FC_N,
                                        FC_DN, MDN)
     self.__simpleNormal = SimpleNormalization()
     self.__fileSourceCustom = FileSourceCustom()
     self.__fileBlockSource = FileBlockSource()
     self.__calcMongo = CalcMongo()
     self.__mongoStatistics = MongoStatistic(self.__mongoUtils)
     self.__dirPath = os.path.abspath(os.curdir)
コード例 #3
0
ファイル: test_calc.py プロジェクト: romus/statistic4text
class TestCalcMongo(unittest.TestCase):

    def setUp(self):
        self.__calcMongo = CalcMongo()

    def testCalcIDF(self):
        self.assertEqual(self.__calcMongo.calcIDF(1, 1), 0, "lg(1) != 0")
        self.assertEqual(self.__calcMongo.calcIDF(10, 100), 1, "lg(10) != 1")
        self.assertEqual(self.__calcMongo.calcIDF(100, 2), 0, "idf != 0")

    def testCalcIDFException(self):
        self.assertRaises(ParamError, self.__calcMongo.calcIDF)
        self.assertRaises(ParamError, self.__calcMongo.calcIDF, 10)
        self.assertRaises(TypeError, self.__calcMongo.calcIDF, 10, 'sf')

    def testCalcTF_IDF(self):
        self.assertEqual(self.__calcMongo.calcTF_IDF(10, 10), 100, "10 * 10 != 100")

    def testCalcTF_IDFException(self):
        self.assertRaises(ParamError, self.__calcMongo.calcTF_IDF)
        self.assertRaises(ParamError, self.__calcMongo.calcTF_IDF, 10)
コード例 #4
0
ファイル: test_calc.py プロジェクト: romus/statistic4text
 def setUp(self):
     self.__calcMongo = CalcMongo()