Skip to content

Commit

Permalink
Minor improvements to hypothesis tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jab committed Feb 18, 2024
1 parent 0761d21 commit 886187a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
"recommendations": [
"HarrisonGoldstein.tyche",
"charliermarsh.ruff",
// "tamasfe.even-better-toml",
// "lextudio.restructuredtext",
Expand Down
11 changes: 11 additions & 0 deletions docs/thanks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ People
Tom Viner for being bidict's Adopt Pytest helper for the month,
and Brianna Laugher for coordinating.

- Zac Hatfield-Dodds for the amazing work
(as well as soliciting feedback) on
`Hypothesis <https://hypothesis.works>`__,
`Hypofuzz <https://hypofuzz.com>`__,
and `Pytest <https://pytest.org>`__.`

- Harrison Goldstein for building
`Tyche <https://marketplace.visualstudio.com/items?itemName=HarrisonGoldstein.tyche>`__
and showing me how to use it.

- Daniel Pope,
Leif Walsh,
David Turner,
Expand Down Expand Up @@ -55,6 +65,7 @@ Projects
- `Tidelift <https://tidelift.com>`__
- `Pytest <https://docs.pytest.org>`__
- `Hypothesis <https://hypothesis.readthedocs.io>`__
- `Tyche <https://marketplace.visualstudio.com/items?itemName=HarrisonGoldstein.tyche>`__
- `Pytest-Benchmark <https://pytest-benchmark.readthedocs.io>`__
- `Coverage <https://coverage.readthedocs.io>`__
- `Codecov <https://codecov.io>`__
Expand Down
6 changes: 1 addition & 5 deletions tests/test_bidict.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from __future__ import annotations

import gc
import operator
import pickle
import sys
import typing as t
Expand Down Expand Up @@ -78,7 +77,7 @@


keys = integers(min_value=1, max_value=10)
vals = keys.map(operator.neg)
vals = integers(min_value=-10, max_value=-1) # faster than keys.map(operator.neg)
InitItems = t.Dict[t.Any, t.Any]
init_items = dictionaries(vals, keys, max_size=MAX_SIZE).map(lambda d: {v: k for (k, v) in d.items()}) # no dup vals
bidict_t = sampled_from(bidict_types)
Expand Down Expand Up @@ -367,9 +366,6 @@ def test_inverted(items: ItemLists, bidict_t: BT[int, int]) -> None:
@given(init_items=init_items)
def test_frozenbidicts_hashable(init_items: InitItems) -> None:
"""Frozen bidicts can be hashed (and therefore inserted into sets and mappings)."""
from hypothesis import event

event('size', len(init_items))
bi = frozenbidict(init_items)
h1 = hash(bi)
h2 = hash(bi)
Expand Down

0 comments on commit 886187a

Please sign in to comment.