Removed legacy usage of Union[]

This commit is contained in:
2024-12-26 18:36:57 +01:00
parent 95d04308bd
commit aa2c778a6a
13 changed files with 128 additions and 149 deletions

View File

@@ -4,7 +4,7 @@ except ImportError:
from json import dumps, JSONDecodeError
from pathlib import Path
from typing import Any, Union
from typing import Any
import pytest
from libbot.utils import json_read, json_write
@@ -23,7 +23,7 @@ from libbot.utils import json_read, json_write
("tests/data/empty.json", {}),
],
)
def test_json_read_valid(path: Union[str, Path], expected: Any):
def test_json_read_valid(path: str | Path, expected: Any):
assert json_read(path) == expected
@@ -34,7 +34,7 @@ def test_json_read_valid(path: Union[str, Path], expected: Any):
("tests/data/nonexistent.json", FileNotFoundError),
],
)
def test_json_read_invalid(path: Union[str, Path], expected: Any):
def test_json_read_invalid(path: str | Path, expected: Any):
with pytest.raises(expected):
assert json_read(path) == expected
@@ -52,7 +52,7 @@ def test_json_read_invalid(path: Union[str, Path], expected: Any):
({}, "tests/data/empty.json"),
],
)
def test_json_write(data: Any, path: Union[str, Path]):
def test_json_write(data: Any, path: str | Path):
json_write(data, path)
assert Path(path).is_file()