Exemple #1
0
    def test_getDetailsLogLevels(self):
        """
        Test the getDetailsLogLevels selection logic
        (and also the getAllExistingLoggers, getAllFancyloggers and
        getAllNonFancyloggers function call)
        """
        # logger names are unique
        for fancy, func in [(False, fancylogger.getAllNonFancyloggers),
                            (True, fancylogger.getAllFancyloggers),
                            (None, fancylogger.getAllExistingLoggers)]:
            self.assertEqual(
                [name for name, _ in func()],
                [name for name, _ in fancylogger.getDetailsLogLevels(fancy)],
                "Test getDetailsLogLevels fancy %s and function %s" %
                (fancy, func.__name__))
        self.assertEqual([
            name for name, _ in fancylogger.getAllFancyloggers()
        ], [
            name for name, _ in fancylogger.getDetailsLogLevels()
        ], "Test getDetailsLogLevels default fancy True and function getAllFancyloggers"
                         )

        res = fancylogger.getDetailsLogLevels(fancy=True)
        self.assertTrue(
            is_string(res[0][1]),
            msg='getDetailsLogLevels returns loglevel names by default')
        res = fancylogger.getDetailsLogLevels(fancy=True, numeric=True)
        self.assertTrue(
            isinstance(res[0][1], int),
            msg='getDetailsLogLevels returns loglevel values with numeric=True'
        )
Exemple #2
0
 def test_getDetailsLogLevels(self):
     """
     Test the getDetailsLogLevels selection logic
     (and also the getAllExistingLoggers, getAllFancyloggers and
     getAllNonFancyloggers function call)
     """
     # logger names are unique
     for fancy, func in [(False, fancylogger.getAllNonFancyloggers),
                         (True, fancylogger.getAllFancyloggers),
                         (None, fancylogger.getAllExistingLoggers)]:
         self.assertEqual([name for name, _ in func()],
                          [name for name, _ in fancylogger.getDetailsLogLevels(fancy)],
                          "Test getDetailsLogLevels fancy %s and function %s" % (fancy, func.__name__))
     self.assertEqual([name for name, _ in fancylogger.getAllFancyloggers()],
                      [name for name, _ in fancylogger.getDetailsLogLevels()],
                      "Test getDetailsLogLevels default fancy True and function getAllFancyloggers")
Exemple #3
0
 def test_getDetailsLogLevels(self):
     """
     Test the getDetailsLogLevels selection logic
     (and also the getAllExistingLoggers, getAllFancyloggers and
     getAllNonFancyloggers function call)
     """
     # logger names are unique
     for fancy, func in [(False, fancylogger.getAllNonFancyloggers),
                         (True, fancylogger.getAllFancyloggers),
                         (None, fancylogger.getAllExistingLoggers)]:
         self.assertEqual([name for name, _ in func()],
                          [name for name, _ in fancylogger.getDetailsLogLevels(fancy)],
                          "Test getDetailsLogLevels fancy %s and function %s" % (fancy, func.__name__))
     self.assertEqual([name for name, _ in fancylogger.getAllFancyloggers()],
                      [name for name, _ in fancylogger.getDetailsLogLevels()],
                      "Test getDetailsLogLevels default fancy True and function getAllFancyloggers")
Exemple #4
0
    def test_getDetailsLogLevels(self):
        """
        Test the getDetailsLogLevels selection logic
        (and also the getAllExistingLoggers, getAllFancyloggers and
        getAllNonFancyloggers function call)
        """
        # logger names are unique
        for fancy, func in [(False, fancylogger.getAllNonFancyloggers),
                            (True, fancylogger.getAllFancyloggers),
                            (None, fancylogger.getAllExistingLoggers)]:
            self.assertEqual([name for name, _ in func()],
                             [name for name, _ in fancylogger.getDetailsLogLevels(fancy)],
                             "Test getDetailsLogLevels fancy %s and function %s" % (fancy, func.__name__))
        self.assertEqual([name for name, _ in fancylogger.getAllFancyloggers()],
                         [name for name, _ in fancylogger.getDetailsLogLevels()],
                         "Test getDetailsLogLevels default fancy True and function getAllFancyloggers")

        res = fancylogger.getDetailsLogLevels(fancy=True)
        self.assertTrue(isinstance(res[0][1], basestring), msg='getDetailsLogLevels returns loglevel names by default')
        res = fancylogger.getDetailsLogLevels(fancy=True, numeric=True)
        self.assertTrue(isinstance(res[0][1], int), msg='getDetailsLogLevels returns loglevel values with numeric=True')