Skip to content

Commit 3b3a0a1

Browse files
committed
feat(Tests): Updates test to support proper nested list input coerce
1 parent f09248f commit 3b3a0a1

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

tests/utilities/test_coerce_input_value.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,24 @@ def returns_null_for_a_null_value():
352352
result = _coerce_value(None, TestNestedList)
353353
assert expect_value(result) is None
354354

355-
def returns_nested_list_for_nested_non_list_values():
355+
def returns_error_for_nested_non_list_values():
356356
result = _coerce_value([1, 2, 3], TestNestedList)
357-
assert expect_value(result) == [[1], [2], [3]]
357+
assert expect_errors(result) == [
358+
("Expected type '[Int]' to be a list.", [0], 1),
359+
("Expected type '[Int]' to be a list.", [1], 2),
360+
("Expected type '[Int]' to be a list.", [2], 3),
361+
]
358362

359363
def returns_nested_null_for_nested_null_values():
364+
result = _coerce_value([[None], [None]], TestNestedList)
365+
assert expect_value(result) == [[None], [None]]
366+
367+
def returns_errors_for_null_values():
360368
result = _coerce_value([42, [None], None], TestNestedList)
361-
assert expect_value(result) == [[42], [None], None]
369+
assert expect_errors(result) == [
370+
("Expected type '[Int]' to be a list.", [0], 42),
371+
("Expected type '[Int]' to be a list.", [2], None),
372+
]
362373

363374
def describe_with_default_on_error():
364375
def throw_error_without_path():

0 commit comments

Comments
 (0)