@@ -79,8 +79,8 @@ def test_concat() -> None:
7979 assert type(b1) == bytes
8080 assert type(b2) == bytes
8181 assert type(b3) == bytes
82- brr1: bytes = bytearray(3)
83- brr2: bytes = bytearray(range(5))
82+ brr1: bytes | bytearray = bytearray(3)
83+ brr2: bytes | bytearray = bytearray(range(5))
8484 b4 = b1 + brr1
8585 assert b4 == b'123\x00\x00\x00'
8686 assert type(brr1) == bytearray
@@ -171,23 +171,23 @@ def test_bytes_slicing() -> None:
171171from typing import Any
172172
173173def test_basics() -> None:
174- brr1: bytes = bytearray(3)
174+ brr1: bytes | bytearray = bytearray(3)
175175 assert brr1 == bytearray(b'\x00\x00\x00')
176176 assert brr1 == b'\x00\x00\x00'
177177 l = [10, 20, 30, 40]
178- brr2: bytes = bytearray(l)
178+ brr2: bytes | bytearray = bytearray(l)
179179 assert brr2 == bytearray(b'\n\x14\x1e(')
180180 assert brr2 == b'\n\x14\x1e('
181- brr3: bytes = bytearray(range(5))
181+ brr3: bytes | bytearray = bytearray(range(5))
182182 assert brr3 == bytearray(b'\x00\x01\x02\x03\x04')
183183 assert brr3 == b'\x00\x01\x02\x03\x04'
184- brr4: bytes = bytearray('string', 'utf-8')
184+ brr4: bytes | bytearray = bytearray('string', 'utf-8')
185185 assert brr4 == bytearray(b'string')
186186 assert brr4 == b'string'
187187 assert len(brr1) == 3
188188 assert len(brr2) == 4
189189
190- def f(b: bytes) -> bool:
190+ def f(b: bytes | bytearray ) -> bool:
191191 return True
192192
193193def test_bytearray_passed_into_bytes() -> None:
@@ -197,7 +197,7 @@ def test_bytearray_passed_into_bytes() -> None:
197197
198198[case testBytearraySlicing]
199199def test_bytearray_slicing() -> None:
200- b: bytes = bytearray(b'abcdefg')
200+ b: bytes | bytearray = bytearray(b'abcdefg')
201201 zero = int()
202202 ten = 10 + zero
203203 two = 2 + zero
@@ -231,7 +231,7 @@ def test_bytearray_slicing() -> None:
231231from testutil import assertRaises
232232
233233def test_bytearray_indexing() -> None:
234- b: bytes = bytearray(b'\xae\x80\xfe\x15')
234+ b: bytes | bytearray = bytearray(b'\xae\x80\xfe\x15')
235235 assert b[0] == 174
236236 assert b[1] == 128
237237 assert b[2] == 254
@@ -260,7 +260,7 @@ def test_bytes_join() -> None:
260260 assert b' '.join([b'a', b'b']) == b'a b'
261261 assert b' '.join([]) == b''
262262
263- x: bytes = bytearray(b' ')
263+ x: bytes | bytearray = bytearray(b' ')
264264 assert x.join([b'a', b'b']) == b'a b'
265265 assert type(x.join([b'a', b'b'])) == bytearray
266266
0 commit comments