Пример #1
0
 def test_format(self, tmpdir):
     record = logging.makeLogRecord(dict(
         created=1547704837.4,
         msg='hello\nworld',
     ))
     f = IndentingFormatter(fmt="%(message)s")
     assert f.format(record) == 'hello\nworld'
Пример #2
0
 def test_format(self, level_name, expected):
     """
     Args:
       level_name: a logging level name (e.g. "WARNING").
     """
     record = self.make_record('hello\nworld', level_name=level_name)
     f = IndentingFormatter(fmt="%(message)s")
     assert f.format(record) == expected
Пример #3
0
 def test_format(self, level_name, expected):
     """
     Args:
       level_name: a logging level name (e.g. "WARNING").
     """
     record = self.make_record('hello\nworld', level_name=level_name)
     f = IndentingFormatter(fmt="%(message)s")
     assert f.format(record) == expected
Пример #4
0
 def test_format_with_timestamp(self, tmpdir):
     record = logging.makeLogRecord(dict(
         created=1547704837.4,
         msg='hello\nworld',
     ))
     f = IndentingFormatter(fmt="%(message)s", add_timestamp=True)
     expected = '2019-01-17T06:00:37 hello\n2019-01-17T06:00:37 world'
     assert f.format(record) == expected
Пример #5
0
 def test_format_deprecated(self, level_name, expected):
     """
     Test that logged deprecation warnings coming from deprecated()
     don't get another prefix.
     """
     record = self.make_record(
         'DEPRECATION: hello\nworld', level_name=level_name,
     )
     f = IndentingFormatter(fmt="%(message)s")
     assert f.format(record) == expected
Пример #6
0
 def test_format_deprecated(self, level_name, expected, utc):
     """
     Test that logged deprecation warnings coming from deprecated()
     don't get another prefix.
     """
     record = self.make_record(
         'DEPRECATION: hello\nworld', level_name=level_name,
     )
     f = IndentingFormatter(fmt="%(message)s")
     assert f.format(record) == expected
Пример #7
0
 def test_format_with_timestamp(self, level_name, expected):
     record = self.make_record('hello\nworld', level_name=level_name)
     f = IndentingFormatter(fmt="%(message)s", add_timestamp=True)
     assert f.format(record) == expected
Пример #8
0
 def test_format_with_timestamp(self, level_name, expected):
     record = self.make_record('hello\nworld', level_name=level_name)
     f = IndentingFormatter(fmt="%(message)s", add_timestamp=True)
     assert f.format(record) == expected
Пример #9
0
 def test_format_with_timestamp(self, level_name: str, expected: str,
                                utc: None) -> None:
     record = self.make_record("hello\nworld", level_name=level_name)
     f = IndentingFormatter(fmt="%(message)s", add_timestamp=True)
     assert f.format(record) == expected