Skip to content

Commit

Permalink
fix: Fixed using callable to check if x is callable instead of `has…
Browse files Browse the repository at this point in the history
…attr` (#27447)
  • Loading branch information
Sai-Suraj-27 authored Dec 7, 2023
1 parent 67566f7 commit dec9ce6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ivy_tests/test_ivy/test_functional/test_core/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,13 +627,13 @@ def test_default(x, default_val, test_flags, backend_fw):
with BackendHandler.update_backend(backend_fw) as ivy_backend:
with_callable = False
if x is not None:
if hasattr(x, "__call__"):
if callable(x):
with_callable = True
else:
x_dtype, x = x
x = x[0].tolist() if isinstance(x, list) else x
else:
if hasattr(default_val, "__call__"):
if callable(default_val):
with_callable = True
else:
dv_dtype, default_val = default_val
Expand Down Expand Up @@ -845,7 +845,7 @@ def test_einops_repeat(
)
def test_exists(x):
if x is not None:
if not hasattr(x, "__call__"):
if not callable(x):
dtype, x = x
ret = ivy.exists(x)
assert isinstance(ret, bool)
Expand Down

0 comments on commit dec9ce6

Please sign in to comment.