Skip to content

Commit

Permalink
Merge pull request #6232 from jkonecny12/f42-fix-format-string
Browse files Browse the repository at this point in the history
Fix bad formatting for `format` function
  • Loading branch information
KKoukiou authored Mar 5, 2025
2 parents 14577c5 + a85f974 commit a68b245
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyanaconda/modules/localization/live_keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _convert_to_xkb_format(self, sources):
# keep only 'xkb' type and raise an error on 'ibus' variants which can't
# be used in localed
if t[0] != "xkb":
msg = _("The live system has layout '%s' which can't be used for installation.")
msg = _("The live system has layout '{}' which can't be used for installation.")
raise KeyboardConfigurationError(msg.format(t[1]))

layout = t[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ def _check_gnome_shell_layouts_conversion(self,
mocked_exec_with_capture,
system_input,
output,
should_raise):
unsupported_layout):
mocked_exec_with_capture.reset_mock()
mocked_exec_with_capture.return_value = system_input

gs = GnomeShellKeyboard()

if should_raise:
with pytest.raises(KeyboardConfigurationError):
if unsupported_layout:
match = fr'.*{unsupported_layout}.*'
with pytest.raises(KeyboardConfigurationError, match=match):
gs.read_keyboard_layouts()
return

Expand All @@ -69,45 +70,45 @@ def test_gnome_shell_keyboard(self, mocked_exec_with_capture):
mocked_exec_with_capture=mocked_exec_with_capture,
system_input=r"[('xkb', 'cz')]",
output=["cz"],
should_raise=False
unsupported_layout=None
)

# test one complex layout is set
self._check_gnome_shell_layouts_conversion(
mocked_exec_with_capture=mocked_exec_with_capture,
system_input=r"[('xkb', 'cz+qwerty')]",
output=["cz (qwerty)"],
should_raise=False
unsupported_layout=None
)

# test multiple layouts are set
self._check_gnome_shell_layouts_conversion(
mocked_exec_with_capture=mocked_exec_with_capture,
system_input=r"[('xkb', 'cz+qwerty'), ('xkb', 'us'), ('xkb', 'cz+dvorak-ucw')]",
output=["cz (qwerty)", "us", "cz (dvorak-ucw)"],
should_raise=False
unsupported_layout=None
)

# test layouts with ibus (ibus will raise error)
self._check_gnome_shell_layouts_conversion(
mocked_exec_with_capture=mocked_exec_with_capture,
system_input=r"[('xkb', 'cz'), ('ibus', 'libpinyin')]",
output=[],
should_raise=True
unsupported_layout='libpinyin'
)

# test only ibus layout (raise the error)
self._check_gnome_shell_layouts_conversion(
mocked_exec_with_capture=mocked_exec_with_capture,
system_input=r"[('ibus', 'libpinyin')]",
output=[],
should_raise=True
unsupported_layout='libpinyin'
)

# test wrong input
self._check_gnome_shell_layouts_conversion(
mocked_exec_with_capture=mocked_exec_with_capture,
system_input=r"wrong input",
output=[],
should_raise=False
unsupported_layout=None
)

0 comments on commit a68b245

Please sign in to comment.