Skip to content

Commit

Permalink
Make compatible with new Hypothesis
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Nov 17, 2023
1 parent 8dcf766 commit f4c1cf4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 0.3.1 - 2023-09-06
- Hypothesis >= 6.89.0 made some internal changes which broke our `from_grammar()`.
This patch restores compatibility, and requires the new Hypothesis.

### 0.3.0 - 2023-09-06
- Even more efficient generation of Python identifiers, using
[Hypothesis 6.84.1](https://hypothesis.readthedocs.io/en/latest/changes.html#v6-84-1)
Expand Down
31 changes: 16 additions & 15 deletions deps/check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ autoflake==2.2.1
# via shed
bandit==1.7.5
# via flake8-bandit
black==23.7.0
black==23.11.0
# via shed
click==8.1.7
# via black
Expand All @@ -29,44 +29,44 @@ flake8==6.1.0
# flake8-docstrings
flake8-bandit==4.1.1
# via -r deps/check.in
flake8-bugbear==23.7.10
flake8-bugbear==23.9.16
# via -r deps/check.in
flake8-comprehensions==3.14.0
# via -r deps/check.in
flake8-docstrings==1.7.0
# via -r deps/check.in
gitdb==4.0.10
gitdb==4.0.11
# via gitpython
gitpython==3.1.34
gitpython==3.1.40
# via bandit
hypothesis==6.84.1
hypothesis==6.89.0
# via -r deps/check.in
isort==5.12.0
# via shed
libcst==1.0.1
libcst==1.1.0
# via shed
markdown-it-py==3.0.0
# via rich
mccabe==0.7.0
# via flake8
mdurl==0.1.2
# via markdown-it-py
mypy==1.5.1
mypy==1.7.0
# via -r deps/check.in
mypy-extensions==1.0.0
# via
# black
# mypy
# typing-inspect
packaging==23.1
packaging==23.2
# via black
pathspec==0.11.2
# via black
pbr==5.11.1
pbr==6.0.0
# via stevedore
platformdirs==3.10.0
platformdirs==4.0.0
# via black
pycodestyle==2.11.0
pycodestyle==2.11.1
# via flake8
pydocstyle==6.3.0
# via flake8-docstrings
Expand All @@ -76,17 +76,17 @@ pyflakes==3.1.0
# flake8
pygments==2.16.1
# via rich
pyupgrade==3.10.1
pyupgrade==3.15.0
# via shed
pyyaml==6.0.1
# via
# bandit
# libcst
rich==13.5.2
rich==13.7.0
# via bandit
shed==2023.6.1
# via -r deps/check.in
smmap==5.0.0
smmap==5.0.1
# via gitdb
snowballstemmer==2.2.0
# via pydocstyle
Expand All @@ -101,8 +101,9 @@ tomli==2.0.1
# autoflake
# black
# mypy
typing-extensions==4.7.1
typing-extensions==4.8.0
# via
# black
# libcst
# mypy
# typing-inspect
Expand Down
21 changes: 11 additions & 10 deletions deps/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,50 @@
#
attrs==23.1.0
# via hypothesis
black==23.7.0
black==23.11.0
# via -r deps/test.in
click==8.1.7
# via black
coverage[toml]==7.3.0
coverage[toml]==7.3.2
# via pytest-cov
exceptiongroup==1.1.3
# via
# hypothesis
# pytest
execnet==2.0.2
# via pytest-xdist
hypothesis[lark]==6.84.1
hypothesis[lark]==6.89.0
# via hypothesmith (setup.py)
iniconfig==2.0.0
# via pytest
lark==1.1.7
lark==1.1.8
# via hypothesis
libcst==1.0.1
libcst==1.1.0
# via hypothesmith (setup.py)
mypy-extensions==1.0.0
# via
# black
# typing-inspect
packaging==23.1
packaging==23.2
# via
# black
# pytest
parso==0.8.3
# via -r deps/test.in
pathspec==0.11.2
# via black
platformdirs==3.10.0
platformdirs==4.0.0
# via black
pluggy==1.3.0
# via pytest
pytest==7.4.1
pytest==7.4.3
# via
# -r deps/test.in
# pytest-cov
# pytest-xdist
pytest-cov==4.1.0
# via -r deps/test.in
pytest-xdist==3.3.1
pytest-xdist==3.4.0
# via -r deps/test.in
pyyaml==6.0.1
# via libcst
Expand All @@ -60,8 +60,9 @@ tomli==2.0.1
# black
# coverage
# pytest
typing-extensions==4.7.1
typing-extensions==4.8.0
# via
# black
# libcst
# typing-inspect
typing-inspect==0.9.0
Expand Down
2 changes: 1 addition & 1 deletion src/hypothesmith/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
from hypothesmith.cst import from_node
from hypothesmith.syntactic import from_grammar

__version__ = "0.3.0"
__version__ = "0.3.1"
__all__ = ["from_grammar", "from_node"]
6 changes: 3 additions & 3 deletions src/hypothesmith/syntactic.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ def do_draw(self, data): # type: ignore
return result

def draw_symbol(self, data, symbol, draw_state): # type: ignore
count = len(draw_state.result)
count = len(draw_state)
super().draw_symbol(data, symbol, draw_state)
if symbol.name in COMPILE_MODES:
try:
compile(
source="".join(draw_state.result[count:]),
source="".join(draw_state[count:]),
filename="<string>",
mode=COMPILE_MODES[symbol.name],
)
Expand All @@ -108,7 +108,7 @@ def draw_symbol(self, data, symbol, draw_state): # type: ignore
# Or the new https://bugs.python.org/issue45738 which makes me
# wish CPython would start running proptests in CI already.
assume(False)
source_code = ascii("".join(draw_state.result[count:]))
source_code = ascii("".join(draw_state[count:]))
raise type(err)(
f"compile({source_code}, '<string>', "
f"{COMPILE_MODES[symbol.name]!r}) "
Expand Down

0 comments on commit f4c1cf4

Please sign in to comment.