Skip to content

Commit

Permalink
Simpler isinstance() calls
Browse files Browse the repository at this point in the history
Supporting Python < 3.10 requires:
	isinstance(x, (A, B))
instead of:
	isinstance(x, A | B)
  • Loading branch information
DimitriPapadopoulos committed Sep 29, 2023
1 parent 33c0516 commit c32ccb6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cramjam-python/benchmarks/test_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def test_lz4_block(benchmark, file, use_cramjam: bool):
[
f
for f in FILES
if not (isinstance(f, FiftyFourMbRandom) or isinstance(f, FiftyFourMbRepeating))
if not (isinstance(f, (FiftyFourMbRandom, FiftyFourMbRepeating))
],
ids=lambda val: val.name,
)
Expand Down
2 changes: 1 addition & 1 deletion cramjam-python/tests/test_rust_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_obj_api(tmpdir, Obj):
buf.readinto(out)

# Will update the output buffer
if isinstance(out, File) or isinstance(out, Buffer):
if isinstance(out, (File, Buffer)):
out.seek(0)
assert out.read() == expected
elif isinstance(out, bytearray):
Expand Down

0 comments on commit c32ccb6

Please sign in to comment.