Skip to content

Commit

Permalink
revert wrong refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nrbnlulu committed Oct 1, 2024
1 parent a444dd2 commit 2c59c71
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/schema/extensions/schema_extensions/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_extension_access_to_errors():
execution_errors = []

class MyExtension(SchemaExtension):
def on_parse(self, execution_context: ExecutionContext):
def on_operation(self, execution_context: ExecutionContext):
nonlocal execution_errors
yield
execution_errors = execution_context.errors
Expand Down Expand Up @@ -168,7 +168,7 @@ def test_extension_access_to_root_value():
root_value = None

class MyExtension(SchemaExtension):
def on_parse(self, execution_context: ExecutionContext):
def on_operation(self, execution_context: ExecutionContext):
nonlocal root_value
yield
root_value = execution_context.root_value
Expand All @@ -194,7 +194,7 @@ class CustomizableExtension(SchemaExtension):
def __init__(self, arg: int):
self.arg = arg

def on_parse(self, execution_context: ExecutionContext):
def on_operation(self, execution_context: ExecutionContext):
yield
execution_context.result.data = {"override": self.arg}

Expand All @@ -212,7 +212,7 @@ def on_parse(self, execution_context: ExecutionContext):
@pytest.fixture()
def sync_extension() -> Type[ExampleExtension]:
class MyExtension(ExampleExtension):
def on_parse(self, execution_context: ExecutionContext):
def on_operation(self, execution_context: ExecutionContext):
with hook_wrap(self.called_hooks, SchemaExtension.on_operation.__name__):
yield

Expand Down Expand Up @@ -258,7 +258,7 @@ async def test_mixed_sync_and_async_extension_hooks(
default_query_types_and_query, sync_extension
):
class MyExtension(sync_extension):
async def on_parse(self, execution_context: ExecutionContext):
async def on_operation(self, execution_context: ExecutionContext):
with hook_wrap(self.called_hooks, SchemaExtension.on_operation.__name__):
yield

Expand Down Expand Up @@ -294,7 +294,7 @@ def register_hook(hook_name: str, klass: type):
called_hooks.append(f"{klass.__name__}, {hook_name} Exited")

class ExtensionA(ExampleExtension):
async def on_parse(self, execution_context: ExecutionContext):
async def on_operation(self, execution_context: ExecutionContext):
with register_hook(SchemaExtension.on_operation.__name__, ExtensionA):
yield

Expand All @@ -311,7 +311,7 @@ def on_execute(self, execution_context: ExecutionContext):
yield

class ExtensionB(ExampleExtension):
async def on_parse(self, execution_context: ExecutionContext):
async def on_operation(self, execution_context: ExecutionContext):
with register_hook(SchemaExtension.on_operation.__name__, ExtensionB):
yield

Expand Down Expand Up @@ -374,7 +374,7 @@ class SyncExt(ExampleExtension):
f"{SchemaExtension.on_parse.__name__} Entered",
]

def on_parse(self, execution_context: ExecutionContext):
def on_operation(self, execution_context: ExecutionContext):
self.called_hooks.append(self.__class__.expected[0])

async def on_parse(self, execution_context: ExecutionContext):
Expand Down Expand Up @@ -897,7 +897,7 @@ def test_extend_error_format_example():
# Test that the example of how to extend error format

class ExtendErrorFormat(SchemaExtension):
def on_parse(self, execution_context: ExecutionContext):
def on_operation(self, execution_context: ExecutionContext):
yield
result = execution_context.result
if getattr(result, "errors", None):
Expand Down Expand Up @@ -937,7 +937,7 @@ def ping(self) -> str:

def test_extension_can_set_query():
class MyExtension(SchemaExtension):
def on_parse(self, execution_context: ExecutionContext):
def on_operation(self, execution_context: ExecutionContext):
execution_context.query = "{ hi }"
yield

Expand All @@ -961,7 +961,7 @@ def hi(self) -> str:
@pytest.mark.asyncio
async def test_extension_can_set_query_async():
class MyExtension(SchemaExtension):
def on_parse(self, execution_context: ExecutionContext):
def on_operation(self, execution_context: ExecutionContext):
execution_context.query = "{ hi }"
yield

Expand Down

0 comments on commit 2c59c71

Please sign in to comment.