Created
April 9, 2017 23:32
-
-
Save bukzor/aebcfcd0a46c20c85d4f62de5994d5d5 to your computer and use it in GitHub Desktop.
hypothesis-py: make check-format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(master) buck@tortle-2016:~/trees/learn/hypothesis-python | |
[Sun 04-09 04:30:39PM]$ make check-format | |
find src tests -name '*.py' -not \( -path '*/vendor/*' -or -name test_lambda_formatting.py \) | /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/tools/bin/python scripts/enforce_header.py | |
# isort will sort packages differently depending on whether they're installed | |
/home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/bin/python -m pip install django pytz pytest fake-factory numpy flaky | |
Requirement already satisfied: django in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages | |
Requirement already satisfied: pytz in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages | |
Requirement already satisfied: pytest in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages | |
Requirement already satisfied: fake-factory in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages | |
Requirement already satisfied: numpy in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages | |
Requirement already satisfied: flaky in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages | |
Requirement already satisfied: setuptools in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages (from pytest) | |
Requirement already satisfied: py>=1.4.29 in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages (from pytest) | |
Requirement already satisfied: packaging>=16.8 in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages (from setuptools->pytest) | |
Requirement already satisfied: six>=1.6.0 in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages (from setuptools->pytest) | |
Requirement already satisfied: appdirs>=1.4.0 in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages (from setuptools->pytest) | |
Requirement already satisfied: pyparsing in /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/isort/lib/python3.4/site-packages (from packaging>=16.8->setuptools->pytest) | |
find src tests -name '*.py' -not \( -path '*/vendor/*' -or -name test_lambda_formatting.py \) | xargs env -i PATH="/home/buck/.cache/hypothesis-build-runtimes/snakepit:/home/buck/.cache/hypothesis-build-runtimes/tools:/home/buck/.nix-profile/bin:/home/buck/.nix-profile/sbin:/home/buck/.local/bin:/home/buck/prefices/brew/sbin:/home/buck/prefices/brew/bin:/home/buck/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/buck/trees/learn/gun/node_modules/.bin/" /home/buck/.cache/hypothesis-build-runtimes/tools/isort -p hypothesis -ls -m 2 -w 75 \ | |
-a "from __future__ import absolute_import, print_function, division" \ | |
-rc src tests examples | |
/#######################################################################\ | |
`sMMy` | |
.yyyy- ` | |
##soos## ./o. | |
` ``..-..` ``...`.`` ` ```` ``-ssso``` | |
.s:-y- .+osssssso/. ./ossss+:so+:` :+o-`/osso:+sssssssso/ | |
.s::y- osss+.``.`` -ssss+-.`-ossso` ssssso/::..::+ssss:::. | |
.s::y- /ssss+//:-.` `ssss+ `ssss+ sssso` :ssss` | |
.s::y- `-/+oossssso/ `ssss/ sssso ssss/ :ssss` | |
.y-/y- ````:ssss` ossso. :ssss: ssss/ :ssss. | |
`/so:` `-//::/osss+ `+ssss+-/ossso: /sso- `osssso/. | |
\/ `-/oooo++/- .:/++:/++/-` .. `://++/. | |
isort your Python imports for you so you don't have to | |
VERSION 4.1.0 | |
\########################################################################/ | |
Skipped 43 files | |
find src tests -name '*.py' -not \( -path '*/vendor/*' -or -name test_lambda_formatting.py \) | xargs /home/buck/.cache/hypothesis-build-runtimes/tools/pyformat -i | |
find src tests -name "*.py" | xargs /home/buck/.cache/hypothesis-build-runtimes/virtualenvs/tools/bin/python scripts/check_encoding_header.py | |
git diff --exit-code | |
diff --git a/src/hypothesis/internal/compat.py b/src/hypothesis/internal/compat.py | |
index 236af34..1789323 100644 | |
--- a/src/hypothesis/internal/compat.py | |
+++ b/src/hypothesis/internal/compat.py | |
@@ -247,6 +247,7 @@ def qualname(f): | |
except AttributeError: | |
return f.__name__ | |
+ | |
FakeArgSpec = namedtuple( | |
'ArgSpec', ('args', 'varargs', 'keywords', 'defaults')) | |
@@ -422,6 +423,7 @@ class compatbytes(bytearray): | |
def __contains__(self, value): | |
return any(v == value for v in self) | |
+ | |
if PY2: | |
hbytes = compatbytes | |
reasonable_byte_type = bytearray | |
@@ -452,6 +454,7 @@ def cast_unicode(s, encoding=None): | |
def get_stream_enc(stream, default=None): | |
return getattr(stream, 'encoding', None) or default | |
+ | |
if PY3: | |
FileNotFoundError = FileNotFoundError | |
else: | |
diff --git a/src/hypothesis/strategies.py b/src/hypothesis/strategies.py | |
index 922f517..22dd8f3 100644 | |
--- a/src/hypothesis/strategies.py | |
+++ b/src/hypothesis/strategies.py | |
@@ -468,7 +468,7 @@ def lists( | |
'want to set unique_by)' | |
)) | |
else: | |
- unique_by = lambda x: x | |
+ def unique_by(x): return x | |
if unique_by is not None: | |
from hypothesis.searchstrategy.collections import UniqueListStrategy | |
diff --git a/tests/cover/test_reflection.py b/tests/cover/test_reflection.py | |
index 73189de..a81f4e3 100644 | |
--- a/tests/cover/test_reflection.py | |
+++ b/tests/cover/test_reflection.py | |
@@ -173,7 +173,7 @@ def test_names_of_functions_are_pretty(): | |
def test_can_have_unicode_in_lambda_sources(): | |
- t = lambda x: 'é' not in x | |
+ def t(x): return 'é' not in x | |
assert get_pretty_function_description(t) == ( | |
"lambda x: 'é' not in x" | |
) | |
@@ -227,7 +227,7 @@ def test_source_of_lambda_is_pretty(): | |
def test_variable_names_are_not_pretty(): | |
- t = lambda x: True # pragma: no cover | |
+ def t(x): return True # pragma: no cover | |
assert get_pretty_function_description(t) == 'lambda x: True' | |
@@ -262,12 +262,12 @@ def test_does_not_error_on_confused_sources(): | |
def test_strips_comments_from_the_end(): | |
- t = lambda x: 1 # pragma: no cover | |
+ def t(x): return 1 # pragma: no cover | |
assert get_pretty_function_description(t) == 'lambda x: 1' | |
def test_does_not_strip_hashes_within_a_string(): | |
- t = lambda x: '#' # pragma: no cover | |
+ def t(x): return '#' # pragma: no cover | |
assert get_pretty_function_description(t) == "lambda x: '#'" | |
@@ -292,7 +292,7 @@ def test_lambda_source_break_after_def_with_brackets(): | |
def test_lambda_source_break_after_def_with_line_continuation(): | |
- f = lambda n:\ | |
+ def f(n): return \ | |
'aaa' | |
source = get_pretty_function_description(f) | |
diff --git a/tests/quality/test_statistical_distribution.py b/tests/quality/test_statistical_distribution.py | |
index 2c817d9..353f3da 100644 | |
--- a/tests/quality/test_statistical_distribution.py | |
+++ b/tests/quality/test_statistical_distribution.py | |
@@ -465,7 +465,9 @@ for i in range(8): | |
# This strategy tests interactions with `map()`. They generate integers | |
# from the set {1, 4, 6, 16, 20, 24, 28, 32}. | |
-double = lambda x: x * 2 | |
+def double(x): return x * 2 | |
+ | |
+ | |
one_of_nested_strategy_with_map = one_of( | |
just(1), | |
one_of( | |
Makefile:90: recipe for target 'check-format' failed | |
make: *** [check-format] Error 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment