Skip to content

Commit

Permalink
[try] test on python3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
CNSeniorious000 committed Oct 29, 2023
1 parent 16c2365 commit ec06c5b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8", "pypy3.9", "pypy3.10"]
python-version: ["3.7", "pypy3.7"]

steps:
- uses: actions/checkout@v3
Expand All @@ -21,8 +21,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip pdm
pdm install
python -m pip install -U pip pdm pytest hypothesis
pdm install --prod
- name: Run tests
run: |
pdm test
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Parse partial JSON generated by LLM"
authors = [{ name = "Muspi Merol", email = "me@promplate.dev" }]
dependencies = []
optional-dependencies = { playground = ["rich"] }
requires-python = ">=3.8"
requires-python = ">=3.7"
readme = "README.md"
license = { text = "MIT" }
scripts = { json-playground = "partial_json_parser.playground:main" }
Expand Down Expand Up @@ -33,8 +33,8 @@ dev = [
]

[tool.pdm.scripts]
test-hypotheses = { call = "tests.test_hypotheses:main" }
test-examples = "pytest tests/test_examples.py"
test-hypotheses = { call = "src.tests.test_hypotheses:main" }
test-examples = "pytest src/tests/test_examples.py"
test = { composite = ["test-examples", "test-hypotheses"] }
format = { composite = ["isort ./{args}", "black ./{args}"] }
playground = { call = "partial_json_parser.playground:main" }
Expand Down
2 changes: 1 addition & 1 deletion src/partial_json_parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
JSON = Union[str, bool, Number, List["JSON"], Dict[str, "JSON"], None]


def parse_json(json_string: str, allow_partial: Union[Allow, int] = ALL, /) -> JSON:
def parse_json(json_string: str, allow_partial: Union[Allow, int] = ALL) -> JSON:
if not isinstance(json_string, str):
raise TypeError(f"expecting str, got {type(json_string).__name__}")
if not json_string.strip():
Expand Down
5 changes: 5 additions & 0 deletions tests/test_examples.py → src/tests/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from math import isnan
from os import getcwd
from sys import path

from pytest import raises

print(getcwd())
path.append(f"{getcwd()}/src")

from partial_json_parser import MalformedJSON, PartialJSON, parse_json
from partial_json_parser.options import *

Expand Down
5 changes: 5 additions & 0 deletions tests/test_hypotheses.py → src/tests/test_hypotheses.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
from json import dumps
from os import getcwd
from sys import path

from hypothesis import given, settings
from hypothesis import strategies as st
from tqdm import tqdm

print(getcwd())
path.append(f"{getcwd()}/src")

from partial_json_parser import parse_json

json = st.recursive(
Expand Down

0 comments on commit ec06c5b

Please sign in to comment.