Skip to content

Commit

Permalink
Update test names
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jul 5, 2022
1 parent 6e44301 commit 7048543
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ When using a @given decorator, any arguments that are not provided in the @given
will be left visible in the final function:

```python
from inspect import getargspec
from inspect import signature

from hypothesis import given, strategies as st

Expand All @@ -34,13 +34,13 @@ def test_stuff(a, b, c, d):
pass


print(getargspec(test_stuff))
print(signature(test_stuff))
```

This then outputs the following:

```
ArgSpec(args=['b', 'd'], varargs=None, keywords=None, defaults=None)
<Signature (b, d)>
```

We've hidden the arguments 'a' and 'c', but the unspecified arguments 'b' and 'd'
Expand All @@ -64,7 +64,7 @@ def test_stuff(a, stuff):
assert stuff == "kittens"
```

This also works if we want to use @given with positional arguments:
This also works if we want to use @given with positional arguments:

```python
from pytest import fixture
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/internal/reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def get_varargs(sig, kind=inspect.Parameter.VAR_POSITIONAL):


def define_function_signature(name, docstring, signature):
"""A decorator which sets the name, argspec and docstring of the function
"""A decorator which sets the name, signature and docstring of the function
passed into it."""
if name == "<lambda>":
name = "_lambda_"
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _inner(*args, **kwargs):
def assert_output_contains_failure(output, test, **kwargs):
assert test.__name__ + "(" in output
for k, v in kwargs.items():
assert f"{k}={v!r}" in output
assert f"{k}={v!r}" in output, (f"{k}={v!r}", output)


def assert_falsifying_output(
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/cover/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def has_annotation(a: int, *b, c=2) -> None:


@pytest.mark.parametrize("f", [has_annotation, lambda *, a: a, lambda *, a=1: a])
def test_copying_preserves_argspec(f):
def test_copying_preserves_signature(f):
af = signature(f)
t = define_function_signature("foo", "docstring", af)(universal_acceptor)
at = signature(t)
Expand Down
4 changes: 2 additions & 2 deletions hypothesis-python/tests/cover/test_unicode_identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from hypothesis.internal.reflection import get_pretty_function_description, proxies


def test_can_copy_argspec_of_unicode_args():
def test_can_copy_signature_of_unicode_args():
def foo(μ):
return μ

Expand All @@ -23,7 +23,7 @@ def bar(μ):
assert bar(1) == 1


def test_can_copy_argspec_of_unicode_name():
def test_can_copy_signature_of_unicode_name():
def ā():
return 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class TestPosOnlyArg(TestCase):
def test_user_issue_2369_regression(self, val):
pass

def test_from_model_argspec(self):
def test_from_model_signature(self):
if sys.version_info[:2] <= (3, 7):
self.assertRaises(TypeError, from_model().example)
self.assertRaises(TypeError, from_model(Car, None).example)
Expand Down

0 comments on commit 7048543

Please sign in to comment.