|
Server : LiteSpeed System : Linux host 5.15.0-161-generic #171-Ubuntu SMP Sat Oct 11 08:17:01 UTC 2025 x86_64 User : idnco5810 ( 1093) PHP Version : 8.2.29 Disable Function : NONE Directory : /lib/python3/dist-packages/twisted/logger/test/ |
Upload File : |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for L{twisted.logger._levels}.
"""
from twisted.trial import unittest
from .._levels import InvalidLogLevelError, LogLevel
class LogLevelTests(unittest.TestCase):
"""
Tests for L{LogLevel}.
"""
def test_levelWithName(self) -> None:
"""
Look up log level by name.
"""
for level in LogLevel.iterconstants():
self.assertIs(LogLevel.levelWithName(level.name), level)
def test_levelWithInvalidName(self) -> None:
"""
You can't make up log level names.
"""
bogus = "*bogus*"
try:
LogLevel.levelWithName(bogus)
except InvalidLogLevelError as e:
self.assertIs(e.level, bogus)
else:
self.fail("Expected InvalidLogLevelError.")