Skip to content

Commit

Permalink
feat(Tests): Updates test to support proper nested list input coerce
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinand-c committed Mar 2, 2023
1 parent f09248f commit 3b3a0a1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/utilities/test_coerce_input_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,24 @@ def returns_null_for_a_null_value():
result = _coerce_value(None, TestNestedList)
assert expect_value(result) is None

def returns_nested_list_for_nested_non_list_values():
def returns_error_for_nested_non_list_values():
result = _coerce_value([1, 2, 3], TestNestedList)
assert expect_value(result) == [[1], [2], [3]]
assert expect_errors(result) == [
("Expected type '[Int]' to be a list.", [0], 1),
("Expected type '[Int]' to be a list.", [1], 2),
("Expected type '[Int]' to be a list.", [2], 3),
]

def returns_nested_null_for_nested_null_values():
result = _coerce_value([[None], [None]], TestNestedList)
assert expect_value(result) == [[None], [None]]

def returns_errors_for_null_values():
result = _coerce_value([42, [None], None], TestNestedList)
assert expect_value(result) == [[42], [None], None]
assert expect_errors(result) == [
("Expected type '[Int]' to be a list.", [0], 42),
("Expected type '[Int]' to be a list.", [2], None),
]

def describe_with_default_on_error():
def throw_error_without_path():
Expand Down

0 comments on commit 3b3a0a1

Please sign in to comment.