Skip to content

Commit e60ff44

Browse files
committed
Add version check to tests
1 parent 60ae321 commit e60ff44

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

stdlib/@tests/test_cases/check_compression.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
from __future__ import annotations
22

33
import io
4-
from _compression import DecompressReader as DecompressReader_other, _Reader as _Reader_other
4+
import sys
55
from _typeshed import ReadableBuffer
66
from bz2 import BZ2Decompressor
7-
from compression._common._streams import DecompressReader, _Decompressor, _Reader
87
from compression.zstd import ZstdDecompressor
98
from lzma import LZMADecompressor
109
from typing import cast
1110
from typing_extensions import assert_type
1211
from zlib import decompressobj
1312

13+
if sys.version_info >= (3, 14):
14+
from compression._common._streams import DecompressReader, _Decompressor, _Reader
15+
else:
16+
from _compression import DecompressReader, _Reader
17+
1418
###
1519
# Tests for DecompressReader/_Decompressor
1620
###
@@ -39,7 +43,6 @@ def accept_decompressor(d: _Decompressor) -> None:
3943
assert_type(d.unused_data, bytes)
4044

4145

42-
# Test objects from compression._common._streams
4346
fp = cast(_Reader, io.BytesIO(b"hello world"))
4447
DecompressReader(fp, decompressobj)
4548
DecompressReader(fp, BZ2Decompressor)
@@ -51,11 +54,3 @@ def accept_decompressor(d: _Decompressor) -> None:
5154
accept_decompressor(LZMADecompressor())
5255
accept_decompressor(ZstdDecompressor())
5356
accept_decompressor(CustomDecompressor())
54-
55-
# Test objects from _compression
56-
fp = cast(_Reader_other, io.BytesIO(b"hello world"))
57-
DecompressReader_other(fp, decompressobj)
58-
DecompressReader_other(fp, BZ2Decompressor)
59-
DecompressReader_other(fp, LZMADecompressor)
60-
DecompressReader_other(fp, ZstdDecompressor)
61-
DecompressReader_other(fp, CustomDecompressor)

0 commit comments

Comments
 (0)