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
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)
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)
def setUp(self): self.__calcMongo = CalcMongo()