From ebf4222dd7fc3b6a9d1cbe7c973447665da5f0cc Mon Sep 17 00:00:00 2001 From: Predrag Gruevski Date: Sun, 23 Dec 2018 21:51:17 -0500 Subject: [PATCH] Add reproducing testcase for TypeError on None sub-expression. --- graphql_compiler/tests/test_compiler.py | 12 +++++++++ graphql_compiler/tests/test_input_data.py | 32 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/graphql_compiler/tests/test_compiler.py b/graphql_compiler/tests/test_compiler.py index fb20324f8..7f5efe845 100644 --- a/graphql_compiler/tests/test_compiler.py +++ b/graphql_compiler/tests/test_compiler.py @@ -2203,6 +2203,18 @@ def test_has_edge_degree_op_filter_with_optional(self): check_test_data(self, test_data, expected_match, expected_gremlin) + def test_has_edge_degree_op_filter_with_optional_and_other_filter(self): + test_data = test_input_data.has_edge_degree_op_filter_with_optional_and_other_filter() + + expected_match = ''' + + ''' + expected_gremlin = ''' + + ''' + + check_test_data(self, test_data, expected_match, expected_gremlin) + def test_has_edge_degree_op_filter_with_fold(self): test_data = test_input_data.has_edge_degree_op_filter_with_fold() diff --git a/graphql_compiler/tests/test_input_data.py b/graphql_compiler/tests/test_input_data.py index 535fa62de..2e3592802 100644 --- a/graphql_compiler/tests/test_input_data.py +++ b/graphql_compiler/tests/test_input_data.py @@ -1253,6 +1253,38 @@ def has_edge_degree_op_filter_with_optional(): type_equivalence_hints=None) +def has_edge_degree_op_filter_with_optional_and_other_filter(): + graphql_input = '''{ + Animal { + name @output(out_name: "animal_name") + uuid @filter(op_name: "between", value: ["$uuid_lower_bound","$uuid_upper_bound"]) + + in_Animal_ParentOf @optional + @filter(op_name: "has_edge_degree", value: ["$number_of_edges"]) { + out_Entity_Related { + ... on Event { + name @output(out_name: "related_event") + } + } + } + } + } + ''' + expected_output_metadata = { + 'animal_name': OutputMetadata(type=GraphQLString, optional=False), + 'related_event': OutputMetadata(type=GraphQLString, optional=True), + } + expected_input_metadata = { + 'number_of_edges': GraphQLInt, + } + + return CommonTestData( + graphql_input=graphql_input, + expected_output_metadata=expected_output_metadata, + expected_input_metadata=expected_input_metadata, + type_equivalence_hints=None) + + def has_edge_degree_op_filter_with_fold(): graphql_input = '''{ Species {