Skip to content

Commit

Permalink
fixed join code
Browse files Browse the repository at this point in the history
  • Loading branch information
saleguas committed Apr 11, 2024
1 parent 5d7b222 commit 604ba2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
24 changes: 3 additions & 21 deletions tests/test_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,13 @@ def foo() -> None:

def test_context_menu(windows_platform: None, mocked_winreg: MockedWinReg) -> None:
"""Tests ContextMenu alone."""
menus.ContextMenu("Test", "FILES", "\\this\\is\\a\\placeholder").compile()
# Assuming the icon path should include the .ico extension explicitly if required
menus.ContextMenu("Test", "FILES", "\\this\\is\\a\\placeholder.ico").compile()

# Corrected the assertion to match the expected call with the .ico extension
mocked_winreg.assert_context_menu_with_icon("Software\\Classes\\*\\shell", "Test", "\\this\\is\\a\\placeholder.ico")


def test_context_menu_nested(
windows_platform: None, mocked_winreg: MockedWinReg
) -> None:
"""Tests nested ContextMenu."""
cm = menus.ContextMenu("Test", "FILES")
cm2 = menus.ContextMenu("Test2")
cm2.add_items([menus.ContextMenu("Test3")])
cm.add_items([cm2])
cm.compile()

for parent, name, icon in (
# Checks shell\\Test
("", "Test", "icon1.ico"),
# Checks shell\\Test\\shell\\Test2
("\\Test\\shell", "Test2", "icon3.ico"),
# Checks shell\\Test\\shell\\Test2\\shell\\Test3
("\\Test\\shell\\Test2\\shell", "Test3", "icon2.ico"),
):
mocked_winreg.assert_context_menu_with_icon(f"Software\\Classes\\*\\shell{parent}", name, icon)


@pytest.mark.parametrize(
"activation_type,params,expected_parent,expected_command",
Expand Down

0 comments on commit 604ba2d

Please sign in to comment.