diff --git a/brother_ql_web/cli.py b/brother_ql_web/cli.py index 78e6ce5..5e9803c 100644 --- a/brother_ql_web/cli.py +++ b/brother_ql_web/cli.py @@ -103,7 +103,9 @@ def update_configuration_from_parameters( if parameters.log_level: # `log_level` will be numeric if parsed from argv, so we enforce the name here. level = parameters.log_level - configuration.server.log_level = logging.getLevelName(level) if isinstance(level, int) else level + configuration.server.log_level = ( + logging.getLevelName(level) if isinstance(level, int) else level + ) if parameters.font_folder: configuration.server.additional_font_folder = parameters.font_folder diff --git a/tests/test_cli.py b/tests/test_cli.py index 7b9365e..a902d65 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -203,10 +203,11 @@ def test_invalid_label_size(self): ) configuration.label.default_size = "dummy" - # Do not assert the label sizes, but make sure that the value list starts with a number. + # Do not assert the label sizes, but make sure that the value list starts with + # a number. with self.assertRaisesRegex( cli.InvalidLabelSize, - "^Invalid default label size\. Please choose one of the following:\\n\d.+$", + r"^Invalid default label size\. Please choose one of the following:\\n\d.+$", # noqa: E501 ): cli.update_configuration_from_parameters( parameters=parameters, configuration=configuration @@ -228,7 +229,7 @@ def test_no_fonts_found(self): with mock.patch.object(cli, "collect_fonts", return_value=[]) as collect_mock: with self.assertRaisesRegex( cli.NoFontFound, - '^Not a single font was found on your system. Please install some or use the "--font-folder" argument.$', + '^Not a single font was found on your system. Please install some or use the "--font-folder" argument.$', # noqa: E501 ): cli.update_configuration_from_parameters( parameters=parameters, configuration=configuration diff --git a/tests/test_font_helpers.py b/tests/test_font_helpers.py index 3181f8c..c535b56 100644 --- a/tests/test_font_helpers.py +++ b/tests/test_font_helpers.py @@ -7,52 +7,52 @@ class GetFontsTestCase(TestCase): # Reference: https://packages.ubuntu.com/lunar/all/fonts-roboto-unhinted/filelist ROBOTO_FILES = { "Roboto": { - "Thin": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Thin.ttf", - "Medium Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-MediumItalic.ttf", - "Thin Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-ThinItalic.ttf", - "Light Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-LightItalic.ttf", - "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Italic.ttf", - "Black Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BlackItalic.ttf", - "Medium": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Medium.ttf", - "Bold": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Bold.ttf", - "Black": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Black.ttf", - "Light": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Light.ttf", - "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Regular.ttf", - "Bold Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BoldItalic.ttf", + "Thin": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Thin.ttf", # noqa: E501 + "Medium Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-MediumItalic.ttf", # noqa: E501 + "Thin Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-ThinItalic.ttf", # noqa: E501 + "Light Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-LightItalic.ttf", # noqa: E501 + "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Italic.ttf", # noqa: E501 + "Black Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BlackItalic.ttf", # noqa: E501 + "Medium": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Medium.ttf", # noqa: E501 + "Bold": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Bold.ttf", # noqa: E501 + "Black": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Black.ttf", # noqa: E501 + "Light": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Light.ttf", # noqa: E501 + "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Regular.ttf", # noqa: E501 + "Bold Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BoldItalic.ttf", # noqa: E501 }, "Roboto Black": { - "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BlackItalic.ttf", - "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Black.ttf", + "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-BlackItalic.ttf", # noqa: E501 + "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Black.ttf", # noqa: E501 }, "Roboto Condensed": { - "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Italic.ttf", - "Bold": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Bold.ttf", - "Medium": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Medium.ttf", - "Bold Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-BoldItalic.ttf", - "Light Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-LightItalic.ttf", - "Light": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Light.ttf", - "Medium Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-MediumItalic.ttf", - "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Regular.ttf", + "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Italic.ttf", # noqa: E501 + "Bold": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Bold.ttf", # noqa: E501 + "Medium": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Medium.ttf", # noqa: E501 + "Bold Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-BoldItalic.ttf", # noqa: E501 + "Light Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-LightItalic.ttf", # noqa: E501 + "Light": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Light.ttf", # noqa: E501 + "Medium Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-MediumItalic.ttf", # noqa: E501 + "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Regular.ttf", # noqa: E501 }, "Roboto Condensed Light": { - "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-LightItalic.ttf", - "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Light.ttf", + "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-LightItalic.ttf", # noqa: E501 + "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Light.ttf", # noqa: E501 }, "Roboto Condensed Medium": { - "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Medium.ttf", - "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-MediumItalic.ttf", + "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-Medium.ttf", # noqa: E501 + "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoCondensed-MediumItalic.ttf", # noqa: E501 }, "Roboto Light": { - "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-LightItalic.ttf", - "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Light.ttf", + "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-LightItalic.ttf", # noqa: E501 + "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Light.ttf", # noqa: E501 }, "Roboto Medium": { - "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-MediumItalic.ttf", - "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Medium.ttf", + "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-MediumItalic.ttf", # noqa: E501 + "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Medium.ttf", # noqa: E501 }, "Roboto Thin": { - "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Thin.ttf", - "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-ThinItalic.ttf", + "Regular": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Thin.ttf", # noqa: E501 + "Italic": "/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-ThinItalic.ttf", # noqa: E501 }, } diff --git a/tests/test_utils.py b/tests/test_utils.py index 7ce0530..7f3145a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -68,7 +68,7 @@ def test_unknown_backend(self): utils.BackendGuessingError, r"^Couln't guess the backend to use from the printer string descriptor$", ): - backend = utils.get_backend_class(configuration) + utils.get_backend_class(configuration) def test_known_backend(self): from brother_ql.backends.linux_kernel import BrotherQLBackendLinuxKernel