From 8c1ef8576f9db1dce13afe43def3476fda93fd24 Mon Sep 17 00:00:00 2001 From: Bobby Lat Date: Mon, 22 Jul 2024 11:17:22 +0800 Subject: [PATCH] remove extra bool() call in assertions --- tests/test_box.py | 10 +++++----- tests/test_box_map.py | 6 +++--- tests/test_box_ref.py | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test_box.py b/tests/test_box.py index 296e286..c00bfba 100644 --- a/tests/test_box.py +++ b/tests/test_box.py @@ -51,7 +51,7 @@ def test_init_with_key( key: bytes | str | Bytes | String, ) -> None: box = Box(value_type, key=key) # type: ignore[var-annotated] - assert not bool(box) + assert not box assert len(box.key) > 0 key_bytes = ( @@ -115,14 +115,14 @@ def test_value_deleter( box.value = value del box.value - assert not bool(box) + assert not box with pytest.raises(ValueError, match=BOX_NOT_CREATED_ERROR): _ = box.value op_box_content, op_box_exists = algopy.op.Box.get(key) assert not op_box_exists - assert not bool(op_box_content) + assert not op_box_content @pytest.mark.parametrize( @@ -177,11 +177,11 @@ def test_maybe_when_box_does_not_exist( del box.value box_content, box_exists = box.maybe() - assert not bool(box_content) + assert not box_content assert not box_exists op_box_content, op_box_exists = algopy.op.Box.get(key) - assert not bool(op_box_content) + assert not op_box_content assert not op_box_exists diff --git a/tests/test_box_map.py b/tests/test_box_map.py index 4fd2163..7ac5562 100644 --- a/tests/test_box_map.py +++ b/tests/test_box_map.py @@ -141,7 +141,7 @@ def test_value_deleter( op_box_content, op_box_exists = algopy.op.Box.get(full_key) assert not op_box_exists - assert not bool(op_box_content) + assert not op_box_content @pytest.mark.parametrize( @@ -213,14 +213,14 @@ def test_maybe_when_box_does_not_exists( del box[key] box_content, box_exists = box.maybe(key) - assert not bool(box_content) + assert not box_content assert not box_exists full_key = box._full_key(key) op_box_content, op_box_exists = algopy.op.Box.get(full_key) assert not op_box_exists - assert not bool(op_box_content) + assert not op_box_content def _assert_box_content_equality( diff --git a/tests/test_box_ref.py b/tests/test_box_ref.py index 8269564..839c16c 100644 --- a/tests/test_box_ref.py +++ b/tests/test_box_ref.py @@ -46,7 +46,7 @@ def test_init_with_key( key: bytes | str | Bytes | String, ) -> None: box = BoxRef(key=key) - assert not bool(box) + assert not box assert len(box.key) > 0 key_bytes = ( @@ -99,7 +99,7 @@ def test_delete( box_existed = box.delete() assert box_existed - assert not bool(box) + assert not box with pytest.raises(ValueError, match=BOX_NOT_CREATED_ERROR): _ = box.length @@ -248,11 +248,11 @@ def test_maybe_when_box_does_not_exist( box.delete() box_content, box_exists = box.maybe() - assert not bool(box_content) + assert not box_content assert not box_exists op_box_content, op_box_exists = algopy.op.Box.get(key) - assert not bool(op_box_content) + assert not op_box_content assert not op_box_exists