Skip to content

Commit 20db358

Browse files
committed
- r typing.ByteString
1 parent 2b9dcd0 commit 20db358

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

approvaltests/approvals.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import xml.dom.minidom
33
from contextlib import contextmanager
44
from pathlib import Path
5-
from typing import Any, ByteString, Callable, Iterator, List, Optional
5+
from typing import Any, Callable, Iterator, List, Optional, Union
66

77
import approvaltests.namer.default_namer_factory
88
import approvaltests.reporters.default_reporter_factory
@@ -34,6 +34,9 @@
3434
__unittest = True
3535
__tracebackhide__ = True
3636

37+
# typing.ByteString was removed in Python 3.14
38+
_ByteString = Union[bytes, bytearray, memoryview]
39+
3740

3841
class Settings:
3942
def allow_multiple_verify_calls_for_this_method(self) -> None:
@@ -147,7 +150,7 @@ def find_formatter_for_specified_class(data: Any) -> Any:
147150

148151

149152
def verify_binary(
150-
data: ByteString,
153+
data: _ByteString,
151154
file_extension_with_dot: str,
152155
*, # enforce keyword arguments - https://www.python.org/dev/peps/pep-3102/
153156
options: Optional[Options] = None,

approvaltests/binary_writer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
from typing import ByteString
1+
from typing import Union
22

33
from typing_extensions import override
44

55
from approval_utilities.utils import create_directory_if_needed
66
from approvaltests.core.writer import Writer
77

8+
# typing.ByteString was removed in Python 3.14
9+
_ByteString = Union[bytes, bytearray, memoryview]
810

911
class BinaryWriter(Writer):
10-
contents: ByteString
12+
contents: _ByteString
1113

1214
def __init__(
1315
self,
14-
contents: ByteString,
16+
contents: _ByteString,
1517
extension: str,
1618
) -> None:
1719
self.contents = contents

0 commit comments

Comments
 (0)