コード例 #1
0
class TestMongoReadUtils(unittest.TestCase):
    def setUp(self):
        date_now = datetime.datetime.now()
        self.__mongoReadUtils = MongoReadUtils(HOST, PORT, USR, PWD, DB, FC_N,
                                               FC_DN)
        self.__mongoUtils = MongoSaveUtils(HOST, PORT, USR, PWD, DB, FC_N,
                                           FC_DN, MDN)
        self.__mongoUtils.saveDict("test_dict1", "utf-8", 1234, {
            "the": 1,
            "test": 2
        }, "utf-8", date_now)
        self.__mongoUtils.saveDict("test_dict2", "utf-8", 4321, {
            "the": 100,
            "object": 2
        }, 'utf-8', date_now)
        self.__mongoUtils.mergeDicts()

    def tearDown(self):
        self.__mongoUtils.deleteMergeDict()

    def testGetDict(self):
        self.assertIsNotNone(
            self.__mongoReadUtils.getDict(self.__mongoUtils.getMergeDictID()),
            "dict not found")

    def testGetSubDicts(self):
        for itemSubDicts in self.__mongoReadUtils.getSubDicts(
                self.__mongoUtils.getMergeDictID()):
            self.assertIsNotNone(itemSubDicts, "sub dict get exception")

    def testGetDictData(self):
        for itemDictData in self.__mongoReadUtils.getDictData(
                self.__mongoUtils.getMergeDictID()):
            self.assertIsNotNone(itemDictData, "dict data is not found")
コード例 #2
0
 def setUp(self):
     date_now = datetime.datetime.now()
     self.__mongoReadUtils = MongoReadUtils(HOST, PORT, USR, PWD, DB, FC_N,
                                            FC_DN)
     self.__mongoUtils = MongoSaveUtils(HOST, PORT, USR, PWD, DB, FC_N,
                                        FC_DN, MDN)
     self.__mongoUtils.saveDict("test_dict1", "utf-8", 1234, {
         "the": 1,
         "test": 2
     }, "utf-8", date_now)
     self.__mongoUtils.saveDict("test_dict2", "utf-8", 4321, {
         "the": 100,
         "object": 2
     }, 'utf-8', date_now)
     self.__mongoUtils.mergeDicts()
コード例 #3
0
 def setUp(self):
     date_now = datetime.datetime.now()
     self.__mongoReadUtils = MongoReadUtils(HOST, PORT, USR, PWD, DB, FC_N, FC_DN)
     self.__mongoUtils = MongoSaveUtils(HOST, PORT, USR, PWD, DB, FC_N, FC_DN, MDN)
     self.__mongoUtils.saveDict("test_dict1", "utf-8", 1234, {"the": 1, "test": 2}, "utf-8", date_now)
     self.__mongoUtils.saveDict("test_dict2", "utf-8", 4321, {"the": 100, "object": 2}, 'utf-8', date_now)
     self.__mongoUtils.mergeDicts()
コード例 #4
0
 def setUp(self):
     self.__dirPath = os.path.abspath(os.curdir)
     firstPath = os.path.join(self.__dirPath, "resources/first")
     secondPath = os.path.join(self.__dirPath, "resources/second")
     self.__mongoSaveUtils = MongoSaveRetrievalUtils(
         HOST, PORT, USR, PWD, DB, FC_N, FC_DN, MDN)
     self.__mongoReadUtils = MongoReadUtils(HOST, PORT, USR, PWD, DB, FC_N,
                                            FC_DN)
     self.__simN = SimpleNormalization()
     self.__simNamesN = FileNameNormalization()
     self.__ms = StatisticFactory().createStatistic(MONGO_TYPE,
                                                    self.__mongoSaveUtils)
     self.__scc = FSSourceCustomCallback()
     self.__rnFS = ReaderNameFS([firstPath, secondPath])
コード例 #5
0
class TestMongoReadUtils(unittest.TestCase):

    def setUp(self):
        date_now = datetime.datetime.now()
        self.__mongoReadUtils = MongoReadUtils(HOST, PORT, USR, PWD, DB, FC_N, FC_DN)
        self.__mongoUtils = MongoSaveUtils(HOST, PORT, USR, PWD, DB, FC_N, FC_DN, MDN)
        self.__mongoUtils.saveDict("test_dict1", "utf-8", 1234, {"the": 1, "test": 2}, "utf-8", date_now)
        self.__mongoUtils.saveDict("test_dict2", "utf-8", 4321, {"the": 100, "object": 2}, 'utf-8', date_now)
        self.__mongoUtils.mergeDicts()

    def tearDown(self):
        self.__mongoUtils.deleteMergeDict()

    def testGetDict(self):
        self.assertIsNotNone(self.__mongoReadUtils.getDict(self.__mongoUtils.getMergeDictID()), "dict not found")

    def testGetSubDicts(self):
        for itemSubDicts in self.__mongoReadUtils.getSubDicts(self.__mongoUtils.getMergeDictID()):
            self.assertIsNotNone(itemSubDicts, "sub dict get exception")

    def testGetDictData(self):
        for itemDictData in self.__mongoReadUtils.getDictData(self.__mongoUtils.getMergeDictID()):
            self.assertIsNotNone(itemDictData, "dict data is not found")
コード例 #6
0
ファイル: test_index.py プロジェクト: romus/iRetrieval
 def setUp(self):
     self.__dirPath = os.path.abspath(os.curdir)
     firstPath = os.path.join(self.__dirPath, "resources/first")
     secondPath = os.path.join(self.__dirPath, "resources/second")
     self.__mongoUtils = MongoSaveRetrievalUtils(HOST, PORT, USR, PWD, DB,
                                                 FC_N, FC_DN, MDN)
     self.__mongoUtilsTypeError = MongoSaveUtils(HOST, PORT, USR, PWD, DB,
                                                 FC_N, FC_DN, MDN)
     self.__mongoReadUtils = MongoReadUtils(HOST, PORT, USR, PWD, DB, FC_N,
                                            FC_DN)
     self.__smN = SimpleNormalization()
     self.__scc = FSSourceCustomCallback()
     self.__rFS = ReaderNameFS([firstPath, secondPath])
     self.__fsWorker = DataSourceWorkerFS()