Hello community, here is the log from the commit of package python-hypothesis for openSUSE:Factory checked in at 2017-11-17 10:37:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-hypothesis (Old) and /work/SRC/openSUSE:Factory/.python-hypothesis.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hypothesis" Fri Nov 17 10:37:15 2017 rev:10 rq:541883 version:3.37.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-hypothesis/python-hypothesis.changes 2017-11-10 14:38:23.705301554 +0100 +++ /work/SRC/openSUSE:Factory/.python-hypothesis.new/python-hypothesis.changes 2017-11-17 10:37:15.294681272 +0100 @@ -1,0 +2,36 @@ +Tue Nov 14 01:32:07 UTC 2017 - a...@gmx.de + +- update to version 3.37.0: + * This is a deprecation release for some health check related + features. + * The following are now deprecated: + + Passing exception_in_generation to suppress_health_check. This + no longer does anything even when passed - All errors that occur + during data generation will now be immediately reraised rather + than going through the health check mechanism. + + Passing random_module to suppress_health_check. This hasn’t done + anything for a long time, but was never explicitly + deprecated. Hypothesis always seeds the random module when + running @given tests, so this is no longer an error and + suppressing it doesn’t do anything. + + Passing non-HealthCheck values in suppress_health_check. This + was previously allowed but never did anything useful. + +------------------------------------------------------------------- +Sat Nov 11 17:16:21 UTC 2017 - a...@gmx.de + +- update to version 3.36.1: + * This is a yak shaving release, mostly concerned with our own + tests. + While getfullargspec() was documented as deprecated in Python 3.5, + it never actually emitted a warning. Our code to silence this + (nonexistent) warning has therefore been removed. + We now run our tests with DeprecationWarning as an error, and made + some minor changes to our own tests as a result. This required + similar upstream updates to coverage and execnet (a test-time + dependency via pytest-xdist). + There is no user-visible change in Hypothesis itself, but we + encourage you to consider enabling deprecations as errors in your + own tests. + +------------------------------------------------------------------- Old: ---- hypothesis-3.36.0.tar.gz New: ---- hypothesis-3.37.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-hypothesis.spec ++++++ --- /var/tmp/diff_new_pack.I22n1F/_old 2017-11-17 10:37:15.710666046 +0100 +++ /var/tmp/diff_new_pack.I22n1F/_new 2017-11-17 10:37:15.714665900 +0100 @@ -24,7 +24,7 @@ %endif %bcond_with test Name: python-hypothesis -Version: 3.36.0 +Version: 3.37.0 Release: 0 Summary: A library for property based testing License: MPL-2.0 ++++++ hypothesis-3.36.0.tar.gz -> hypothesis-3.37.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/PKG-INFO new/hypothesis-3.37.0/PKG-INFO --- old/hypothesis-3.36.0/PKG-INFO 2017-11-06 15:20:13.000000000 +0100 +++ new/hypothesis-3.37.0/PKG-INFO 2017-11-12 21:11:25.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: hypothesis -Version: 3.36.0 +Version: 3.37.0 Summary: A library for property based testing Home-page: https://github.com/HypothesisWorks/hypothesis-python Author: David R. MacIver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/_settings.py new/hypothesis-3.37.0/src/hypothesis/_settings.py --- old/hypothesis-3.36.0/src/hypothesis/_settings.py 2017-11-06 15:19:12.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/_settings.py 2017-11-12 21:10:23.000000000 +0100 @@ -35,6 +35,7 @@ from hypothesis.errors import InvalidArgument, HypothesisDeprecationWarning from hypothesis.configuration import hypothesis_home_dir from hypothesis.utils.conventions import UniqueIdentifier, not_set +from hypothesis.internal.validation import try_convert from hypothesis.utils.dynamicvariables import DynamicVariable __all__ = [ @@ -481,13 +482,40 @@ @unique class HealthCheck(Enum): + """Arguments for :attr:`~hypothesis.settings.suppress_health_check`. + + Each member of this enum is a type of health check to suppress. + + """ + exception_in_generation = 0 + """Deprecated and no longer does anything. It used to convert errors in + data generation into FailedHealthCheck error.""" + data_too_large = 1 + """Check for when the typical size of the examples you are generating + exceeds the maximum allowed size too often.""" + filter_too_much = 2 + """Check for when the test is filtering out too many examples, either + through use of :func:`~hypothesis.assume()` or :ref:`filter() <filtering>`, + or occasionally for Hypothesis internal reasons.""" + too_slow = 3 + """Check for when your data generation is extremely slow and likely to hurt + testing.""" + random_module = 4 + """Deprecated and no longer does anything. It used to check for whether + your tests used the global random module. Now @given tests automatically + seed random so this is no longer an error.""" + return_value = 5 + """Checks if your tests return a non-None value (which will be ignored and + is unlikely to do what you want).""" + hung_test = 6 + """Checks if your tests have been running for a very long time.""" @unique @@ -598,10 +626,33 @@ """ ) + +def validate_health_check_suppressions(suppressions): + suppressions = try_convert(list, suppressions, 'suppress_health_check') + for s in suppressions: + if not isinstance(s, HealthCheck): + note_deprecation(( + 'Non-HealthCheck value %r of type %s in suppress_health_check ' + 'will be ignored, and will become an error in a future ' + 'version of Hypothesis') % ( + s, type(s).__name__, + )) + elif s in ( + HealthCheck.exception_in_generation, HealthCheck.random_module + ): + note_deprecation(( + '%s is now ignored and suppressing it is a no-op. This will ' + 'become an error in a future version of Hypothesis. Simply ' + 'remove it from your list of suppressions to get the same ' + 'effect.') % (s,)) + return suppressions + + settings.define_setting( 'suppress_health_check', - default=[], - description="""A list of health checks to disable.""" + default=(), + description="""A list of health checks to disable.""", + validator=validate_health_check_suppressions ) settings.define_setting( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/core.py new/hypothesis-3.37.0/src/hypothesis/core.py --- old/hypothesis-3.36.0/src/hypothesis/core.py 2017-11-06 15:19:12.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/core.py 2017-11-12 21:10:23.000000000 +0100 @@ -41,8 +41,7 @@ from hypothesis._settings import settings as Settings from hypothesis._settings import Phase, Verbosity, HealthCheck, \ note_deprecation -from hypothesis.executors import new_style_executor, \ - default_new_style_executor +from hypothesis.executors import new_style_executor from hypothesis.reporting import report, verbose_report, current_verbosity from hypothesis.statistics import note_engine_for_statistics from hypothesis.internal.compat import ceil, str_to_bytes, \ @@ -323,7 +322,7 @@ lambda *args, **kwargs: None, )) except BaseException: - pass + escalate_hypothesis_internal_error() count = 0 overruns = 0 filtered_draws = 0 @@ -353,39 +352,7 @@ overruns += 1 except InvalidArgument: raise - except Exception: - escalate_hypothesis_internal_error() - if ( - HealthCheck.exception_in_generation in - settings.suppress_health_check - ): - raise - report(traceback.format_exc()) - if test_runner is default_new_style_executor: - fail_health_check( - settings, - 'An exception occurred during data ' - 'generation in initial health check. ' - 'This indicates a bug in the strategy. ' - 'This could either be a Hypothesis bug or ' - "an error in a function you've passed to " - 'it to construct your data.', - HealthCheck.exception_in_generation, - ) - else: - fail_health_check( - settings, - 'An exception occurred during data ' - 'generation in initial health check. ' - 'This indicates a bug in the strategy. ' - 'This could either be a Hypothesis bug or ' - 'an error in a function you\'ve passed to ' - 'it to construct your data. Additionally, ' - 'you have a custom executor, which means ' - 'that this could be your executor failing ' - 'to handle a function which returns None. ', - HealthCheck.exception_in_generation, - ) + if overruns >= 20 or ( not count and overruns > 0 ): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/errors.py new/hypothesis-3.37.0/src/hypothesis/errors.py --- old/hypothesis-3.36.0/src/hypothesis/errors.py 2017-11-06 15:19:12.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/errors.py 2017-11-12 21:10:23.000000000 +0100 @@ -202,3 +202,10 @@ '%.2fms') % (runtime, deadline)) self.runtime = runtime self.deadline = deadline + + +class StopTest(BaseException): + + def __init__(self, testcounter): + super(StopTest, self).__init__(repr(testcounter)) + self.testcounter = testcounter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/extra/pandas/impl.py new/hypothesis-3.37.0/src/hypothesis/extra/pandas/impl.py --- old/hypothesis-3.36.0/src/hypothesis/extra/pandas/impl.py 2017-11-06 15:19:12.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/extra/pandas/impl.py 2017-11-12 21:10:23.000000000 +0100 @@ -31,6 +31,8 @@ from hypothesis.control import reject from hypothesis.internal.compat import hrange from hypothesis.internal.coverage import check, check_function +from hypothesis.internal.validation import check_type, try_convert, \ + check_strategy, check_valid_size, check_valid_interval try: from pandas.api.types import is_categorical_dtype @@ -63,7 +65,7 @@ prefix = '%s.' % (source,) if elements is not None: - st.check_strategy(elements, '%selements' % (prefix,)) + check_strategy(elements, '%selements' % (prefix,)) else: with check('dtype is not None'): if dtype is None: @@ -78,7 +80,7 @@ prefix, )) - dtype = st.try_convert(np.dtype, dtype, 'dtype') + dtype = try_convert(np.dtype, dtype, 'dtype') if elements is None: elements = npst.from_dtype(dtype) @@ -156,11 +158,11 @@ it will default to some suitable value based on min_size. """ - st.check_valid_size(min_size, 'min_size') - st.check_valid_size(max_size, 'max_size') + check_valid_size(min_size, 'min_size') + check_valid_size(max_size, 'max_size') if max_size is None: max_size = min([min_size + DEFAULT_MAX_SIZE, 2 ** 63 - 1]) - st.check_valid_interval(min_size, max_size, 'min_size', 'max_size') + check_valid_interval(min_size, max_size, 'min_size', 'max_size') return st.integers(min_size, max_size).map(pandas.RangeIndex) @@ -189,10 +191,10 @@ should be distinct. """ - st.check_valid_size(min_size, 'min_size') - st.check_valid_size(max_size, 'max_size') - st.check_valid_interval(min_size, max_size, 'min_size', 'max_size') - st.check_type(bool, unique, 'unique') + check_valid_size(min_size, 'min_size') + check_valid_size(max_size, 'max_size') + check_valid_interval(min_size, max_size, 'min_size', 'max_size') + check_type(bool, unique, 'unique') elements, dtype = elements_and_dtype(elements, dtype) @@ -241,7 +243,7 @@ if index is None: index = range_indexes() else: - st.check_strategy(index) + check_strategy(index) elements, dtype = elements_and_dtype(elements, dtype) index_strategy = index @@ -435,7 +437,7 @@ if index is None: index = range_indexes() else: - st.check_strategy(index) + check_strategy(index) index_strategy = index @@ -452,7 +454,7 @@ @check_function def row(): result = draw(rows) - st.check_type(Iterable, result, 'draw(row)') + check_type(Iterable, result, 'draw(row)') return result if len(index) > 0: @@ -469,13 +471,13 @@ return rows_only() assert columns is not None - columns = st.try_convert(tuple, columns, 'columns') + columns = try_convert(tuple, columns, 'columns') rewritten_columns = [] column_names = set() for i, c in enumerate(columns): - st.check_type(column, c, 'columns[%d]' % (i,)) + check_type(column, c, 'columns[%d]' % (i,)) c = copy(c) if c.name is None: @@ -625,7 +627,7 @@ seen.add(value) if has_duplicate: continue - row = list(st.try_convert(tuple, row, 'draw(rows)')) + row = list(try_convert(tuple, row, 'draw(rows)')) if len(row) > len(rewritten_columns): raise InvalidArgument(( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/internal/compat.py new/hypothesis-3.37.0/src/hypothesis/internal/compat.py --- old/hypothesis-3.36.0/src/hypothesis/internal/compat.py 2017-11-06 15:19:12.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/internal/compat.py 2017-11-12 21:10:23.000000000 +0100 @@ -294,22 +294,6 @@ else: from inspect import getfullargspec, FullArgSpec - if sys.version_info[:2] == (3, 5): - # silence deprecation warnings on Python 3.5 - # (un-deprecated in 3.6 to allow single-source 2/3 code like this) - def silence_warnings(func): - import warnings - import functools - - @functools.wraps(func) - def inner(*args, **kwargs): - with warnings.catch_warnings(): - warnings.simplefilter('ignore', DeprecationWarning) - return func(*args, **kwargs) - return inner - - getfullargspec = silence_warnings(getfullargspec) - if sys.version_info[:2] < (3, 6): def get_type_hints(thing): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/internal/conjecture/data.py new/hypothesis-3.37.0/src/hypothesis/internal/conjecture/data.py --- old/hypothesis-3.36.0/src/hypothesis/internal/conjecture/data.py 2017-11-06 15:19:12.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/internal/conjecture/data.py 2017-11-12 21:10:23.000000000 +0100 @@ -20,10 +20,11 @@ import sys from enum import IntEnum -from hypothesis.errors import Frozen, InvalidArgument +from hypothesis.errors import Frozen, StopTest, InvalidArgument from hypothesis.internal.compat import hbytes, hrange, text_type, \ bit_length, benchmark_time, int_from_bytes, unicode_safe_repr from hypothesis.internal.coverage import IN_COVERAGE_TESTS +from hypothesis.internal.escalation import mark_for_escalation class Status(IntEnum): @@ -33,13 +34,6 @@ INTERESTING = 3 -class StopTest(BaseException): - - def __init__(self, testcounter): - super(StopTest, self).__init__(repr(testcounter)) - self.testcounter = testcounter - - global_test_counter = 0 @@ -129,9 +123,17 @@ return self.__draw(strategy) def __draw(self, strategy): + at_top_level = self.depth == 0 self.start_example() try: - return strategy.do_draw(self) + if not at_top_level: + return strategy.do_draw(self) + else: + try: + return strategy.do_draw(self) + except BaseException as e: + mark_for_escalation(e) + raise finally: if not self.frozen: self.stop_example() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/internal/escalation.py new/hypothesis-3.37.0/src/hypothesis/internal/escalation.py --- old/hypothesis-3.36.0/src/hypothesis/internal/escalation.py 2017-11-06 15:19:12.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/internal/escalation.py 2017-11-12 21:10:23.000000000 +0100 @@ -23,7 +23,8 @@ import coverage import hypothesis -from hypothesis.errors import DeadlineExceeded +from hypothesis.errors import StopTest, DeadlineExceeded, \ + HypothesisException, UnsatisfiedAssumption from hypothesis.internal.compat import text_type, binary_type, \ encoded_filepath @@ -53,15 +54,26 @@ is_hypothesis_file = belongs_to(hypothesis) is_coverage_file = belongs_to(coverage) +HYPOTHESIS_CONTROL_EXCEPTIONS = ( + DeadlineExceeded, StopTest, UnsatisfiedAssumption +) + + +def mark_for_escalation(e): + if not isinstance(e, HYPOTHESIS_CONTROL_EXCEPTIONS): + e.hypothesis_internal_always_escalate = True + def escalate_hypothesis_internal_error(): if PREVENT_ESCALATION: return - error_type, _, tb = sys.exc_info() + error_type, e, tb = sys.exc_info() + if getattr(e, 'hypothesis_internal_always_escalate', False): + raise import traceback filepath = traceback.extract_tb(tb)[-1][0] - if is_hypothesis_file(filepath) and not issubclass( - error_type, DeadlineExceeded + if is_hypothesis_file(filepath) and not isinstance( + e, (HypothesisException,) + HYPOTHESIS_CONTROL_EXCEPTIONS, ): raise # This is so that if we do something wrong and trigger an internal Coverage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/internal/validation.py new/hypothesis-3.37.0/src/hypothesis/internal/validation.py --- old/hypothesis-3.36.0/src/hypothesis/internal/validation.py 1970-01-01 01:00:00.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/internal/validation.py 2017-11-12 21:10:23.000000000 +0100 @@ -0,0 +1,147 @@ +# coding=utf-8 +# +# This file is part of Hypothesis, which may be found at +# https://github.com/HypothesisWorks/hypothesis-python +# +# Most of this work is copyright (C) 2013-2017 David R. MacIver +# (da...@drmaciver.com), but it contains contributions by others. See +# CONTRIBUTING.rst for a full list of people who may hold copyright, and +# consult the git log if you need to determine who owns an individual +# contribution. +# +# This Source Code Form is subject to the terms of the Mozilla Public License, +# v. 2.0. If a copy of the MPL was not distributed with this file, You can +# obtain one at http://mozilla.org/MPL/2.0/. +# +# END HEADER + +from __future__ import division, print_function, absolute_import + +import math +from numbers import Rational + +from hypothesis.errors import InvalidArgument +from hypothesis.internal.compat import integer_types +from hypothesis.internal.coverage import check_function + + +@check_function +def check_type(typ, arg, name=''): + if name: + name += '=' + if not isinstance(arg, typ): + if isinstance(typ, type): + typ_string = typ.__name__ + else: + typ_string = 'one of %s' % ( + ', '.join(t.__name__ for t in typ)) + raise InvalidArgument('Expected %s but got %s%r (type=%s)' + % (typ_string, name, arg, type(arg).__name__)) + + +@check_function +def check_strategy(arg, name=''): + from hypothesis.searchstrategy import SearchStrategy + check_type(SearchStrategy, arg, name) + + +@check_function +def check_valid_integer(value): + """Checks that value is either unspecified, or a valid integer. + + Otherwise raises InvalidArgument. + + """ + if value is None: + return + check_type(integer_types, value) + + +@check_function +def check_valid_bound(value, name): + """Checks that value is either unspecified, or a valid interval bound. + + Otherwise raises InvalidArgument. + + """ + if value is None or isinstance(value, integer_types + (Rational,)): + return + if math.isnan(value): + raise InvalidArgument(u'Invalid end point %s=%r' % (name, value)) + + +@check_function +def try_convert(typ, value, name): + if value is None: + return None + if isinstance(value, typ): + return value + try: + return typ(value) + except TypeError: + raise InvalidArgument( + 'Cannot convert %s=%r of type %s to type %s' % ( + name, value, type(value).__name__, typ.__name__ + ) + ) + except (OverflowError, ValueError): + raise InvalidArgument( + 'Cannot convert %s=%r to type %s' % ( + name, value, typ.__name__ + ) + ) + + +@check_function +def check_valid_size(value, name): + """Checks that value is either unspecified, or a valid non-negative size + expressed as an integer/float. + + Otherwise raises InvalidArgument. + + """ + if value is None: + return + check_type(integer_types + (float,), value) + if value < 0: + raise InvalidArgument(u'Invalid size %s=%r < 0' % (name, value)) + if isinstance(value, float) and math.isnan(value): + raise InvalidArgument(u'Invalid size %s=%r' % (name, value)) + + +@check_function +def check_valid_interval(lower_bound, upper_bound, lower_name, upper_name): + """Checks that lower_bound and upper_bound are either unspecified, or they + define a valid interval on the number line. + + Otherwise raises InvalidArgument. + + """ + if lower_bound is None or upper_bound is None: + return + if upper_bound < lower_bound: + raise InvalidArgument( + 'Cannot have %s=%r < %s=%r' % ( + upper_name, upper_bound, lower_name, lower_bound + )) + + +@check_function +def check_valid_sizes(min_size, average_size, max_size): + check_valid_size(min_size, 'min_size') + check_valid_size(max_size, 'max_size') + check_valid_size(average_size, 'average_size') + check_valid_interval(min_size, max_size, 'min_size', 'max_size') + check_valid_interval(average_size, max_size, 'average_size', 'max_size') + check_valid_interval(min_size, average_size, 'min_size', 'average_size') + + if ( + average_size == 0 and ( + max_size is None or + max_size > 0 + ) + ): + raise InvalidArgument( + 'Cannot have average_size=%r with non-zero max_size=%r' % ( + average_size, min_size + )) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/strategies.py new/hypothesis-3.37.0/src/hypothesis/strategies.py --- old/hypothesis-3.36.0/src/hypothesis/strategies.py 2017-11-06 15:19:12.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/strategies.py 2017-11-12 21:10:23.000000000 +0100 @@ -23,7 +23,6 @@ import operator from decimal import Context, Decimal from inspect import isclass, isfunction -from numbers import Rational from fractions import Fraction from functools import reduce @@ -33,14 +32,15 @@ from hypothesis.internal.cache import LRUReusedCache from hypothesis.searchstrategy import SearchStrategy from hypothesis.internal.compat import gcd, ceil, floor, hrange, \ - text_type, integer_types, get_type_hints, getfullargspec, \ - implements_iterator + text_type, get_type_hints, getfullargspec, implements_iterator from hypothesis.internal.floats import is_negative, float_to_int, \ int_to_float, count_between_floats -from hypothesis.internal.coverage import check_function from hypothesis.internal.renaming import renamed_arguments from hypothesis.utils.conventions import infer, not_set from hypothesis.internal.reflection import proxies, required_args +from hypothesis.internal.validation import check_type, try_convert, \ + check_strategy, check_valid_bound, check_valid_sizes, \ + check_valid_integer, check_valid_interval __all__ = [ 'nothing', @@ -433,6 +433,9 @@ return SampledFromStrategy(values) +_AVERAGE_LIST_LENGTH = 5.0 + + @cacheable @defines_strategy def lists( @@ -1652,131 +1655,6 @@ types._global_type_lookup[custom_type] = strategy from_type.__clear_cache() -# Private API below here - - -@check_function -def check_type(typ, arg, name=''): - if name: - name += '=' - if not isinstance(arg, typ): - if isinstance(typ, type): - typ_string = typ.__name__ - else: - typ_string = 'one of %s' % ( - ', '.join(t.__name__ for t in typ)) - raise InvalidArgument('Expected %s but got %s%r (type=%s)' - % (typ_string, name, arg, type(arg).__name__)) - - -@check_function -def check_strategy(arg, name=''): - check_type(SearchStrategy, arg, name) - - -@check_function -def check_valid_integer(value): - """Checks that value is either unspecified, or a valid integer. - - Otherwise raises InvalidArgument. - - """ - if value is None: - return - check_type(integer_types, value) - - -@check_function -def check_valid_bound(value, name): - """Checks that value is either unspecified, or a valid interval bound. - - Otherwise raises InvalidArgument. - - """ - if value is None or isinstance(value, integer_types + (Rational,)): - return - if math.isnan(value): - raise InvalidArgument(u'Invalid end point %s=%r' % (name, value)) - - -@check_function -def try_convert(typ, value, name): - if value is None: - return None - if isinstance(value, typ): - return value - try: - return typ(value) - except TypeError: - raise InvalidArgument( - 'Cannot convert %s=%r of type %s to type %s' % ( - name, value, type(value).__name__, typ.__name__ - ) - ) - except (OverflowError, ValueError): - raise InvalidArgument( - 'Cannot convert %s=%r to type %s' % ( - name, value, typ.__name__ - ) - ) - - -@check_function -def check_valid_size(value, name): - """Checks that value is either unspecified, or a valid non-negative size - expressed as an integer/float. - - Otherwise raises InvalidArgument. - - """ - if value is None: - return - check_type(integer_types + (float,), value) - if value < 0: - raise InvalidArgument(u'Invalid size %s %r < 0' % (value, name)) - if isinstance(value, float) and math.isnan(value): - raise InvalidArgument(u'Invalid size %s %r' % (value, name)) - - -@check_function -def check_valid_interval(lower_bound, upper_bound, lower_name, upper_name): - """Checks that lower_bound and upper_bound are either unspecified, or they - define a valid interval on the number line. - - Otherwise raises InvalidArgument. - - """ - if lower_bound is None or upper_bound is None: - return - if upper_bound < lower_bound: - raise InvalidArgument( - 'Cannot have %s=%r < %s=%r' % ( - upper_name, upper_bound, lower_name, lower_bound - )) - - -@check_function -def check_valid_sizes(min_size, average_size, max_size): - check_valid_size(min_size, 'min_size') - check_valid_size(max_size, 'max_size') - check_valid_size(average_size, 'average_size') - check_valid_interval(min_size, max_size, 'min_size', 'max_size') - check_valid_interval(average_size, max_size, 'average_size', 'max_size') - check_valid_interval(min_size, average_size, 'min_size', 'average_size') - - if average_size is not None: - if ( - (max_size is None or max_size > 0) and - average_size is not None and average_size <= 0.0 - ): - raise InvalidArgument( - 'Cannot have average_size=%r < min_size=%r' % ( - average_size, min_size - )) - - -_AVERAGE_LIST_LENGTH = 5.0 - @cacheable def deferred(definition): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis/version.py new/hypothesis-3.37.0/src/hypothesis/version.py --- old/hypothesis-3.36.0/src/hypothesis/version.py 2017-11-06 15:20:13.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis/version.py 2017-11-12 21:11:25.000000000 +0100 @@ -17,5 +17,5 @@ from __future__ import division, print_function, absolute_import -__version_info__ = (3, 36, 0) +__version_info__ = (3, 37, 0) __version__ = '.'.join(map(str, __version_info__)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis.egg-info/PKG-INFO new/hypothesis-3.37.0/src/hypothesis.egg-info/PKG-INFO --- old/hypothesis-3.36.0/src/hypothesis.egg-info/PKG-INFO 2017-11-06 15:20:13.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis.egg-info/PKG-INFO 2017-11-12 21:11:25.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: hypothesis -Version: 3.36.0 +Version: 3.37.0 Summary: A library for property based testing Home-page: https://github.com/HypothesisWorks/hypothesis-python Author: David R. MacIver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-3.36.0/src/hypothesis.egg-info/SOURCES.txt new/hypothesis-3.37.0/src/hypothesis.egg-info/SOURCES.txt --- old/hypothesis-3.36.0/src/hypothesis.egg-info/SOURCES.txt 2017-11-06 15:20:13.000000000 +0100 +++ new/hypothesis-3.37.0/src/hypothesis.egg-info/SOURCES.txt 2017-11-12 21:11:25.000000000 +0100 @@ -44,6 +44,7 @@ src/hypothesis/internal/lazyformat.py src/hypothesis/internal/reflection.py src/hypothesis/internal/renaming.py +src/hypothesis/internal/validation.py src/hypothesis/internal/conjecture/__init__.py src/hypothesis/internal/conjecture/data.py src/hypothesis/internal/conjecture/engine.py