| 1 |
# This file is part of Hypothesis, which may be found at |
| 2 |
# https://github.com/HypothesisWorks/hypothesis/ |
| 3 |
# |
| 4 |
# Copyright the Hypothesis Authors. |
| 5 |
# Individual contributors are listed in AUTHORS.rst and the git log. |
| 6 |
# |
| 7 |
# This Source Code Form is subject to the terms of the Mozilla Public License, |
| 8 |
# v. 2.0. If a copy of the MPL was not distributed with this file, You can |
| 9 |
# obtain one at https://mozilla.org/MPL/2.0/. |
| 10 |
|
| 11 |
"""A stable file for which we can write patches. Don't move stuff around!""" |
| 12 |
|
| 13 |
from pathlib import Path |
| 14 |
|
| 15 |
import numpy as np |
| 16 |
|
| 17 |
from hypothesis import example, given, strategies as st |
| 18 |
from hypothesis.extra import numpy as npst |
| 19 |
|
| 20 |
WHERE = Path(__file__).relative_to(Path.cwd()) |
| 21 |
|
| 22 |
|
| 23 |
@given(st.integers()) |
| 24 |
def fn(x): |
| 25 |
"""A trivial test function.""" |
| 26 |
|
| 27 |
|
| 28 |
class Cases: |
| 29 |
@example(n=0, label="whatever") |
| 30 |
@given(st.integers(), st.text()) |
| 31 |
def mth(self, n, label): |
| 32 |
"""Indented method with existing example decorator.""" |
| 33 |
|
| 34 |
|
| 35 |
@given(st.integers()) |
| 36 |
@example(x=2).via("not a literal when repeated " * 2) |
| 37 |
@example(x=1).via("covering example") |
| 38 |
def covered(x): |
| 39 |
"""A test function with a removable explicit example.""" |
| 40 |
|
| 41 |
|
| 42 |
@given(npst.arrays(np.int8, 1)) |
| 43 |
def undef_name(array): |
| 44 |
assert sum(array) < 100 |
| 45 |
|
| 46 |
|
| 47 |
# TODO: test function for insertion-order logic, once I get that set up. |