Removed legacy usage of Union[]
This commit is contained in:
@@ -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
|
||||
@@ -24,7 +24,7 @@ from libbot.utils import json_read, json_write
|
||||
("tests/data/empty.json", {}),
|
||||
],
|
||||
)
|
||||
async def test_json_read_valid(path: Union[str, Path], expected: Any):
|
||||
async def test_json_read_valid(path: str | Path, expected: Any):
|
||||
assert await json_read(path) == expected
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ async def test_json_read_valid(path: Union[str, Path], expected: Any):
|
||||
("tests/data/nonexistent.json", FileNotFoundError),
|
||||
],
|
||||
)
|
||||
async def test_json_read_invalid(path: Union[str, Path], expected: Any):
|
||||
async def test_json_read_invalid(path: str | Path, expected: Any):
|
||||
with pytest.raises(expected):
|
||||
await json_read(path)
|
||||
|
||||
@@ -55,7 +55,7 @@ async def test_json_read_invalid(path: Union[str, Path], expected: Any):
|
||||
({}, "tests/data/empty.json"),
|
||||
],
|
||||
)
|
||||
async def test_json_write(data: Any, path: Union[str, Path]):
|
||||
async def test_json_write(data: Any, path: str | Path):
|
||||
await json_write(data, path)
|
||||
|
||||
assert Path(path).is_file()
|
||||
|
Reference in New Issue
Block a user