Skip to content

Commit

Permalink
fix(python): accept PathLike or str
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Oct 10, 2024
1 parent 96f0118 commit fde6381
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/cql2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class SqlQuery:

class Expr:
@staticmethod
def from_path(path: PathLike) -> Expr:
def from_path(path: PathLike | str) -> Expr:
"""Reads CQL2 from a filesystem path.
Args:
path (PathLike): The input path
path (PathLike | str): The input path
Returns:
Expr: The CQL2 expression
Expand Down
4 changes: 4 additions & 0 deletions python/tests/test_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ def test_from_path(fixtures: Path) -> None:
Expr.from_path(fixtures / "text" / "example01.txt")


def test_from_path_str(fixtures: Path) -> None:
Expr.from_path(str(fixtures / "text" / "example01.txt"))


def test_init(example01_text: str) -> None:
Expr(example01_text)

Expand Down

0 comments on commit fde6381

Please sign in to comment.