From d37d33d5ee03775a14aedb8bee5b71ae98f21b8d Mon Sep 17 00:00:00 2001 From: Felix Hirwa Nshuti Date: Wed, 7 Feb 2024 18:28:22 +0000 Subject: [PATCH] fix Shape.__bool__ method tests --- ivy/__init__.py | 2 +- ivy_tests/test_ivy/test_misc/test_shape.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ivy/__init__.py b/ivy/__init__.py index 1a074aec61900..1b36fcccf31fe 100644 --- a/ivy/__init__.py +++ b/ivy/__init__.py @@ -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 diff --git a/ivy_tests/test_ivy/test_misc/test_shape.py b/ivy_tests/test_ivy/test_misc/test_shape.py index f20c34bb3a386..e7ce71505161a 100644 --- a/ivy_tests/test_ivy/test_misc/test_shape.py +++ b/ivy_tests/test_ivy/test_misc/test_shape.py @@ -5,6 +5,8 @@ from ivy_tests.test_ivy.helpers import handle_method +CLASS_TREE = "ivy.Shape" + @handle_method( method_tree="Shape.__add__", @@ -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")), @@ -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={},