-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds query params to find and find_one (#130)
- Loading branch information
Showing
8 changed files
with
193 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,9 @@ coverage | |
mypy | ||
pandas | ||
pre-commit | ||
pyjson5 | ||
pytest | ||
responses | ||
ruff | ||
setuptools-scm | ||
setuptools | ||
setuptools-scm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
import json | ||
import pyjson5 as json | ||
|
||
from pathlib import Path | ||
|
||
|
||
def load_mock(path: str) -> dict: | ||
""" | ||
Read a JSON object from `path` | ||
Load mock data from a file. | ||
Reads a JSON or JSONC (JSON with Comments) file and returns the parsed data. | ||
It's primarily used for loading mock data for tests. | ||
The file names for mock data should match the query path that they represent. | ||
Parameters | ||
---------- | ||
path : str | ||
The relative path to the JSONC file. | ||
Returns | ||
------- | ||
dict | ||
The parsed data from the JSONC file. | ||
Examples | ||
-------- | ||
>>> data = load_mock("v1/example.json") | ||
>>> data = load_mock("v1/example.jsonc") | ||
""" | ||
return json.loads((Path(__file__).parent / "__api__" / path).read_text()) |
Oops, something went wrong.