Skip to content

Commit c4e39e8

Browse files
committed
refactor: continue Union type syntax modernization
Additional conversions of `Union[X, Y]` to `X < /dev/null | Y` in logging and test modules for consistent modern type annotation syntax.
1 parent 6f43ccd commit c4e39e8

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/pytest_plugins/logging/logging.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from datetime import datetime, timezone
2121
from logging import LogRecord
2222
from pathlib import Path
23-
from typing import Any, ClassVar, Optional, Union, cast
23+
from typing import Any, ClassVar, Optional, cast
2424

2525
import pytest
2626
from _pytest.terminal import TerminalReporter
@@ -43,7 +43,7 @@ def verbose(
4343
self,
4444
msg: object,
4545
*args: Any,
46-
exc_info: Union[BaseException, bool, None] = None,
46+
exc_info: BaseException | bool | None = None,
4747
stack_info: bool = False,
4848
stacklevel: int = 1,
4949
extra: Optional[dict[str, Any]] = None,
@@ -63,7 +63,7 @@ def fail(
6363
self,
6464
msg: object,
6565
*args: Any,
66-
exc_info: Union[BaseException, bool, None] = None,
66+
exc_info: BaseException | bool | None = None,
6767
stack_info: bool = False,
6868
stacklevel: int = 1,
6969
extra: Optional[dict[str, Any]] = None,
@@ -156,8 +156,8 @@ def from_cli(cls, value: str) -> int:
156156

157157

158158
def configure_logging(
159-
log_level: Union[int, str] = "INFO",
160-
log_file: Optional[Union[str, Path]] = None,
159+
log_level: int | str = "INFO",
160+
log_file: Optional[str | Path] = None,
161161
log_to_stdout: bool = True,
162162
log_format: str = "%(asctime)s [%(levelname)s] %(name)s: %(message)s",
163163
use_color: Optional[bool] = None,

tests/istanbul/eip152_blake2/test_blake2.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
Test cases for [EIP-152: BLAKE2b compression precompile](https://eips.ethereum.org/EIPS/eip-152).
44
"""
55

6-
from typing import Union
7-
86
import pytest
97

108
from ethereum_test_tools import (
@@ -388,7 +386,7 @@ def test_blake2b(
388386
pre: Alloc,
389387
call_opcode: Op,
390388
blake2b_contract_bytecode: Bytecode,
391-
data: Union[Blake2bInput, str, bytes],
389+
data: Blake2bInput | str | bytes,
392390
output: ExpectedOutput,
393391
):
394392
"""Test BLAKE2b precompile."""
@@ -517,7 +515,7 @@ def test_blake2b_invalid_gas(
517515
call_opcode: Op,
518516
blake2b_contract_bytecode: Bytecode,
519517
gas_limit: int,
520-
data: Union[Blake2bInput, str, bytes],
518+
data: Blake2bInput | str | bytes,
521519
output: ExpectedOutput,
522520
):
523521
"""Test BLAKE2b precompile invalid calls using different gas limits."""
@@ -638,7 +636,7 @@ def test_blake2b_gas_limit(
638636
call_opcode: Op,
639637
blake2b_contract_bytecode: Bytecode,
640638
gas_limit: int,
641-
data: Union[Blake2bInput, str, bytes],
639+
data: Blake2bInput | str | bytes,
642640
output: ExpectedOutput,
643641
):
644642
"""Test BLAKE2b precompile with different gas limits."""
@@ -775,7 +773,7 @@ def test_blake2b_large_gas_limit(
775773
pre: Alloc,
776774
call_opcode: Op,
777775
blake2b_contract_bytecode: Bytecode,
778-
data: Union[Blake2bInput, str, bytes],
776+
data: Blake2bInput | str | bytes,
779777
output: ExpectedOutput,
780778
):
781779
"""Test BLAKE2b precompile with large gas limit."""

0 commit comments

Comments
 (0)