From 3b3a0a1dfd8bd0e056a6cae991cb0e9e0e0aecbf Mon Sep 17 00:00:00 2001 From: Abhinand C Date: Fri, 3 Mar 2023 00:23:12 +0530 Subject: [PATCH] feat(Tests): Updates test to support proper nested list input coerce --- tests/utilities/test_coerce_input_value.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/utilities/test_coerce_input_value.py b/tests/utilities/test_coerce_input_value.py index f34e8564..5b0155df 100644 --- a/tests/utilities/test_coerce_input_value.py +++ b/tests/utilities/test_coerce_input_value.py @@ -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():