Skip to content

Commit

Permalink
Fix lint and test
Browse files Browse the repository at this point in the history
  • Loading branch information
yilinjuang committed Apr 9, 2024
1 parent dd74d10 commit c22aa0d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/graphql/pyutils/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from __future__ import annotations

from typing import Any, NamedTuple, Optional
from typing import NamedTuple

__all__ = ["Path"]


class Path(NamedTuple):
"""A generic path of string or integer indices"""

prev: Optional[Path]
prev: Path | None
"""path with the previous indices"""
key: str | int
"""current index in the path (string or integer)"""
Expand All @@ -25,7 +25,7 @@ def as_list(self) -> list[str | int]:
"""Return a list of the path keys."""
flattened: list[str | int] = []
append = flattened.append
curr: Path = self
curr: Path | None = self
while curr:
append(curr.key)
curr = curr.prev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
from typing_extensions import TypeAlias


MYPY = False

__all__ = ["OverlappingFieldsCanBeMergedRule"]


Expand Down
2 changes: 2 additions & 0 deletions tests/execution/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,11 @@ def resolve_type(_val, _info, _type):
prev, key, typename = path
assert key == "l2"
assert typename == "SomeObject"
assert prev is not None
prev, key, typename = prev
assert key == 0
assert typename is None
assert prev is not None
prev, key, typename = prev
assert key == "l1"
assert typename == "SomeQuery"
Expand Down

0 comments on commit c22aa0d

Please sign in to comment.