Skip to content

Commit

Permalink
Touch up typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
Horofic committed Sep 3, 2024
1 parent 9bba691 commit 5bc26d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from __future__ import annotations

import pathlib
import tempfile
import textwrap
from io import BytesIO
from typing import Callable, Iterator, Optional
from typing import Callable, Iterator

import pytest

Expand Down Expand Up @@ -50,7 +52,7 @@ def make_mock_target(tmp_path: pathlib.Path) -> Iterator[Target]:
def make_os_target(
tmp_path: pathlib.Path,
os_plugin: type[OSPlugin],
root_fs: Optional[Filesystem] = None,
root_fs: Filesystem | None = None,
apply_target: bool = True,
) -> Target:
mock_target = next(make_mock_target(tmp_path))
Expand Down
16 changes: 9 additions & 7 deletions tests/plugins/os/windows/test__os.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Any, Iterator, Optional
from __future__ import annotations

from typing import Any, Iterator

import pytest

Expand Down Expand Up @@ -39,7 +41,7 @@ def target_win_linux_folders(target_win: Filesystem, fs_linux_sys: Filesystem) -
yield target_win


def map_version_value(target: Target, name: Optional[str], value: Any):
def map_version_value(target: Target, name: str | None, value: Any):
if name is not None:
hive = target.registry._root
hive.map_value(CURRENT_VERSION_KEY, name, VirtualValue(hive, name, value))
Expand All @@ -62,7 +64,7 @@ def assert_value(result: Any, value: Any):
def test_windowsplugin__legacy_curre_ntversion(
version_target: Target,
win_plugin: WindowsPlugin,
name: Optional[str],
name: str | None,
value: Any,
):
map_version_value(version_target, name, value)
Expand All @@ -81,7 +83,7 @@ def test_windowsplugin__legacy_curre_ntversion(
def test_windowsplugin__major_version(
version_target: Target,
win_plugin: WindowsPlugin,
name: Optional[str],
name: str | None,
value: Any,
):
map_version_value(version_target, name, value)
Expand All @@ -100,7 +102,7 @@ def test_windowsplugin__major_version(
def test_windowsplugin__minor_version(
version_target: Target,
win_plugin: WindowsPlugin,
name: Optional[str],
name: str | None,
value: Any,
):
map_version_value(version_target, name, value)
Expand Down Expand Up @@ -137,7 +139,7 @@ def test_windowsplugin__nt_version(
version_target: Target,
win_plugin: WindowsPlugin,
keys: list[tuple[str, Any]],
value: Optional[str],
value: str | None,
):
for key_name, key_value in keys:
map_version_value(version_target, key_name, key_value)
Expand Down Expand Up @@ -236,7 +238,7 @@ def test_windowsplugin_version(
version_target: Target,
win_plugin: WindowsPlugin,
keys: list[tuple[str, Any]],
value: Optional[str],
value: str | None,
):
for key_name, key_value in keys:
map_version_value(version_target, key_name, key_value)
Expand Down

0 comments on commit 5bc26d4

Please sign in to comment.