Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Shape.__bool__ method tests #28218

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading