Skip to content

Commit

Permalink
remove extra bool() call in assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
boblat committed Jul 22, 2024
1 parent ec60a6e commit 8c1ef85
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions tests/test_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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


Expand Down
6 changes: 3 additions & 3 deletions tests/test_box_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions tests/test_box_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 8c1ef85

Please sign in to comment.