Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit fff11f0

Browse files
cleanup
1 parent 5f6cb7e commit fff11f0

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

graphql_api/tests/test_validation.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
create_max_depth_rule,
1313
)
1414

15+
16+
def resolve_field(*args):
17+
return "test"
18+
19+
1520
QueryType = GraphQLObjectType(
16-
"Query", {"field": GraphQLField(GraphQLString, resolve=lambda *args: "test")}
21+
"Query", {"field": GraphQLField(GraphQLString, resolve=resolve_field)}
1722
)
1823
schema = GraphQLSchema(query=QueryType)
1924

@@ -50,7 +55,16 @@ def test_max_depth_rule_rejects_exceeding_depth():
5055
)
5156

5257

53-
# Tests for MaxAliasesRule
58+
def test_max_depth_rule_exact_depth():
59+
query = """
60+
query {
61+
field
62+
}
63+
"""
64+
errors = validate_query(query, create_max_depth_rule(2))
65+
assert not errors, "Expected no errors when query depth matches the limit"
66+
67+
5468
def test_max_aliases_rule_allows_within_alias_limit():
5569
query = """
5670
query {
@@ -75,16 +89,6 @@ def test_max_aliases_rule_rejects_exceeding_alias_limit():
7589
assert any("Query uses too many aliases" in str(e) for e in errors)
7690

7791

78-
def test_max_depth_rule_exact_depth():
79-
query = """
80-
query {
81-
field
82-
}
83-
"""
84-
errors = validate_query(query, create_max_depth_rule(2))
85-
assert not errors, "Expected no errors when query depth matches the limit"
86-
87-
8892
def test_max_aliases_rule_exact_alias_limit():
8993
query = """
9094
query {

0 commit comments

Comments
 (0)