Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ def _array(this, *args, **kwargs):


def _range(this, *args, **kwargs):
args = list(args)
for index, arg in enumerate(args):
if not isinstance(arg, int):
converted = []
for arg in args:
if isinstance(arg, int):
converted.append(arg)
else:
try:
args[index] = int(arg)
except ValueError:
args.pop(index)
converted.append(int(arg))
except (ValueError, TypeError):
continue
args = converted
if len(args) == 1:
return list(range(args[0]))
if len(args) == 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ async def test_it_renders_kernel_functions_arg_from_arguments(kernel: Kernel, de
("range", "0 5 2", "[0, 2, 4]"),
("range", "0 5 1 1", "[]"),
("range", "'a' 5", "[0, 1, 2, 3, 4]"),
("range", "'a' 'b' 5", "[0, 1, 2, 3, 4]"),
("concat", "'test1' 'test2' 'test3'", "test1test2test3"),
("or", "true false", "true"),
("add", "1 2", "3.0"),
Expand Down
Loading