Skip to content

Commit

Permalink
Upgrade to the latest black (#2157)
Browse files Browse the repository at this point in the history
Upgrade to the latest black
  • Loading branch information
Zac-HD committed Oct 30, 2019
2 parents 0640d8e + 7f9ea93 commit dcf8923
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 19 deletions.
4 changes: 4 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RELEASE_TYPE: patch

This release updates Hypothesis's formatting to the new version of black, and
has absolutely no user visible effect.
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/extra/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def from_dtype(dtype):
res = st.just(dtype.str.split("[")[-1][:-1])
else:
res = st.sampled_from(TIME_RESOLUTIONS)
result = st.builds(dtype.type, st.integers(-2 ** 63, 2 ** 63 - 1), res)
result = st.builds(dtype.type, st.integers(-(2 ** 63), 2 ** 63 - 1), res)
else:
raise InvalidArgument(u"No strategy inference for {}".format(dtype))
return result.map(dtype.type)
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/searchstrategy/attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def types_to_strategy(attrib, types):
strategy from the mess."""
# If we know types from the validator(s), that's sufficient.
if len(types) == 1:
typ, = types
(typ,) = types
if isinstance(typ, tuple):
return st.one_of(*map(st.from_type, typ))
return st.from_type(typ)
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def abc(x, y, z):
sampled_from(("a", "b", "c")),
integers(),
integers(min_value=3),
integers(min_value=(-2 ** 32), max_value=(2 ** 64)),
integers(min_value=(-(2 ** 32)), max_value=(2 ** 64)),
floats(),
floats(min_value=-2.0, max_value=3.0),
floats(),
Expand Down
10 changes: 5 additions & 5 deletions hypothesis-python/tests/cover/test_conjecture_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def run_to_data(f):
runner = ConjectureRunner(f, settings=TEST_SETTINGS)
runner.run()
assert runner.interesting_examples
last_data, = runner.interesting_examples.values()
(last_data,) = runner.interesting_examples.values()
return last_data


Expand Down Expand Up @@ -120,7 +120,7 @@ def f(data):

runner = ConjectureRunner(f, settings=settings(database=db), database_key=key)
runner.run()
last_data, = runner.interesting_examples.values()
(last_data,) = runner.interesting_examples.values()
assert last_data.buffer == value
assert len(list(db.fetch(key))) == 1

Expand Down Expand Up @@ -159,7 +159,7 @@ def draw_bytes(data, n):
database_key=b"key",
)
runner.run()
last_data, = runner.interesting_examples.values()
(last_data,) = runner.interesting_examples.values()
assert last_data.status == Status.INTERESTING
assert runner.shrinks == n
in_db = set(db.data[runner.secondary_key])
Expand Down Expand Up @@ -987,7 +987,7 @@ def accept(f):
)
runner.cached_test_function(start)
assert runner.interesting_examples
last_data, = runner.interesting_examples.values()
(last_data,) = runner.interesting_examples.values()
return runner.new_shrinker(
last_data, lambda d: d.status == Status.INTERESTING
)
Expand Down Expand Up @@ -1113,7 +1113,7 @@ def f(data):
range(6, 11)
)

v, = runner.interesting_examples.values()
(v,) = runner.interesting_examples.values()

assert list(v.buffer) == [5]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_function(data):
def minimal_from(start, condition):
runner = float_runner(start, condition)
runner.shrink_interesting_examples()
v, = runner.interesting_examples.values()
(v,) = runner.interesting_examples.values()
result = flt.draw_float(ConjectureData.for_buffer(v.buffer))
assert condition(result)
return result
Expand Down Expand Up @@ -235,5 +235,5 @@ def test_converts_floats_to_integer_form(f):

runner = float_runner(f, lambda g: g == f)
runner.shrink_interesting_examples()
v, = runner.interesting_examples.values()
(v,) = runner.interesting_examples.values()
assert v.buffer[:-1] < buf
2 changes: 1 addition & 1 deletion hypothesis-python/tests/cover/test_phases.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_usage(i):
with pytest.raises(ValueError):
test_usage()

saved, = [v for k, v in database.data.items() if b"coverage" not in k]
(saved,) = [v for k, v in database.data.items() if b"coverage" not in k]
assert len(saved) == 1


Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/nocover/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def f(x):
f()

assert len(log) == 1
record, = log
(record,) = log
# We got the warning we expected, from the right file
assert isinstance(record.message, HypothesisDeprecationWarning)
assert record.message.args == (msg,)
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/nocover/test_simple_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_single_integer_range_is_range():


def test_minimal_small_number_in_large_range():
assert minimal(integers((-2 ** 32), 2 ** 32), lambda x: x >= 101) == 101
assert minimal(integers((-(2 ** 32)), 2 ** 32), lambda x: x >= 101) == 101


def test_minimal_small_sum_float_list():
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/quality/test_integers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def f(data):

assert runner.interesting_examples

v, = runner.interesting_examples.values()
(v,) = runner.interesting_examples.values()

shrinker = runner.new_shrinker(v, lambda x: x.status == Status.INTERESTING)

Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/quality/test_poisoned_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ def test_function(data):

runner = TrialRunner(test_function, random=Random(seed), settings=TRIAL_SETTINGS)
runner.run()
v, = runner.interesting_examples.values()
(v,) = runner.interesting_examples.values()
result = ConjectureData.for_buffer(v.buffer).draw(strategy)
assert len(result) == 1
4 changes: 2 additions & 2 deletions hypothesis-python/tests/quality/test_poisoned_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_function(data):

runner.shrink_interesting_examples()

data, = runner.interesting_examples.values()
(data,) = runner.interesting_examples.values()

assert len(ConjectureData.for_buffer(data.buffer).draw(strat)) == size

Expand Down Expand Up @@ -135,6 +135,6 @@ def test_function_with_poison(data):
assert runner.interesting_examples
runner.shrink_interesting_examples()

shrunk, = runner.interesting_examples.values()
(shrunk,) = runner.interesting_examples.values()

assert ConjectureData.for_buffer(shrunk.buffer).draw(strat) == (POISON,)
2 changes: 1 addition & 1 deletion hypothesis-python/tests/quality/test_zig_zagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_function(data):

runner.run()

v, = runner.interesting_examples.values()
(v,) = runner.interesting_examples.values()

data = ConjectureData.for_buffer(v.buffer)

Expand Down
2 changes: 1 addition & 1 deletion requirements/tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ autoflake==1.3.1
babel==2.7.0 # via sphinx
backcall==0.1.0 # via ipython
bandit==1.6.2
black==19.3b0
black==19.10b0
blacken-docs==1.3.0
bleach==3.1.0 # via readme-renderer
certifi==2019.9.11 # via requests
Expand Down

0 comments on commit dcf8923

Please sign in to comment.