Skip to content

Commit

Permalink
fix: Shape.__bool__ method tests (#28218)
Browse files Browse the repository at this point in the history
  • Loading branch information
fnhirwa authored Feb 9, 2024
1 parent 81a0371 commit 9789ea5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ivy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def __rmul__(self, other):
return self

def __bool__(self):
return self._shape.__bool__()
return self._shape[0].__bool__()

def __div__(self, other):
return self._shape // other
Expand Down
5 changes: 4 additions & 1 deletion ivy_tests/test_ivy/test_misc/test_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from ivy_tests.test_ivy.helpers import handle_method

CLASS_TREE = "ivy.Shape"


@handle_method(
method_tree="Shape.__add__",
Expand Down Expand Up @@ -44,6 +46,7 @@ def test_shape__add__(


@handle_method(
init_tree=CLASS_TREE,
method_tree="Shape.__bool__",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=st.one_of(st.just(("bool",)), helpers.get_dtypes("integer")),
Expand All @@ -69,7 +72,7 @@ def test_shape__bool__(
backend_to_test=backend_fw,
init_flags=init_flags,
method_flags=method_flags,
init_all_as_kwargs_np={"data": x[0]},
init_all_as_kwargs_np={"shape_tup": (x[0],)},
init_input_dtypes=dtype,
method_input_dtypes=[],
method_all_as_kwargs_np={},
Expand Down

0 comments on commit 9789ea5

Please sign in to comment.