2022-01-01 17:58:48 +00:00
|
|
|
# Copyright 2009-2022 Joshua Bronson. All Rights Reserved.
|
2018-12-29 18:13:04 +00:00
|
|
|
#
|
|
|
|
# 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/.
|
|
|
|
|
|
|
|
"""Set up hypothesis."""
|
|
|
|
|
Various API changes and other improvements.
* Deprecate ``bidict.OVERWRITE`` and ``bidict.IGNORE``.
A :class:`UserWarning` will now be emitted if these are used.
:attr:`bidict.DROP_OLD` and :attr:`bidict.DROP_NEW` should be used instead.
* Rename ``DuplicationPolicy`` to :class:`~bidict.OnDupAction`
(and implement it via an :class:`~enum.Enum`).
A :class:`~bidict.OnDupAction` may be one of
:attr:`~bidict.RAISE`,
:attr:`~bidict.DROP_OLD`, or
:attr:`~bidict.DROP_NEW`.
* Expose the new :class:`~bidict.OnDup` class,
a named (*key*, *val*, *kv*) tuple of :class:`~bidict.OnDupAction`\s
that should be taken upon encountering
the 3 kinds of duplication that can occur.
* Provide the
:attr:`~bidict.ON_DUP_DEFAULT`,
:attr:`~bidict.ON_DUP_RAISE`, and
:attr:`~bidict.ON_DUP_DROP_OLD`
:class:`~bidict.OnDup` convenience instances.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv`` arguments
of :meth:`~bidict.bidict.put` and :meth:`~bidict.bidict.putall`.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new *on_dup* argument,
which takes an :class:`~bidict.OnDup` instance.
Use it like this: ``bi.put(1, 2, OnDup(key=DROP_NEW))``.
Or better yet, pass one of the
``ON_DUP_*`` convenience instances
instead if possible.
See the updated :ref:`basic-usage:Values Must Be Unique` docs for more info.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv``
bidict class attributes.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new
:attr:`~bidict.bidict.on_dup` class attribute,
which takes an :class:`~bidict.OnDup` instance.
See the updated :doc:`extending` docs for example usage.
* Move
:meth:`bidict.BidictBase.values` to
:meth:`bidict.BidirectionalMapping.values`,
since the implementation is generic.
* No longer use ``__all__`` in ``bidict/__init__.py``.
* Cap max_size rather than disabling health checks and deadline as a
less heavyhanded way to improve hypothesis test reliability on Travis.
2020-01-07 22:20:20 +00:00
|
|
|
from datetime import timedelta
|
2018-12-29 18:13:04 +00:00
|
|
|
from os import getenv
|
Various API changes and other improvements.
* Deprecate ``bidict.OVERWRITE`` and ``bidict.IGNORE``.
A :class:`UserWarning` will now be emitted if these are used.
:attr:`bidict.DROP_OLD` and :attr:`bidict.DROP_NEW` should be used instead.
* Rename ``DuplicationPolicy`` to :class:`~bidict.OnDupAction`
(and implement it via an :class:`~enum.Enum`).
A :class:`~bidict.OnDupAction` may be one of
:attr:`~bidict.RAISE`,
:attr:`~bidict.DROP_OLD`, or
:attr:`~bidict.DROP_NEW`.
* Expose the new :class:`~bidict.OnDup` class,
a named (*key*, *val*, *kv*) tuple of :class:`~bidict.OnDupAction`\s
that should be taken upon encountering
the 3 kinds of duplication that can occur.
* Provide the
:attr:`~bidict.ON_DUP_DEFAULT`,
:attr:`~bidict.ON_DUP_RAISE`, and
:attr:`~bidict.ON_DUP_DROP_OLD`
:class:`~bidict.OnDup` convenience instances.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv`` arguments
of :meth:`~bidict.bidict.put` and :meth:`~bidict.bidict.putall`.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new *on_dup* argument,
which takes an :class:`~bidict.OnDup` instance.
Use it like this: ``bi.put(1, 2, OnDup(key=DROP_NEW))``.
Or better yet, pass one of the
``ON_DUP_*`` convenience instances
instead if possible.
See the updated :ref:`basic-usage:Values Must Be Unique` docs for more info.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv``
bidict class attributes.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new
:attr:`~bidict.bidict.on_dup` class attribute,
which takes an :class:`~bidict.OnDup` instance.
See the updated :doc:`extending` docs for example usage.
* Move
:meth:`bidict.BidictBase.values` to
:meth:`bidict.BidirectionalMapping.values`,
since the implementation is generic.
* No longer use ``__all__`` in ``bidict/__init__.py``.
* Cap max_size rather than disabling health checks and deadline as a
less heavyhanded way to improve hypothesis test reliability on Travis.
2020-01-07 22:20:20 +00:00
|
|
|
|
|
|
|
from hypothesis import settings
|
2018-12-29 18:13:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
MAX_EXAMPLES_DEFAULT = 200
|
Various API changes and other improvements.
* Deprecate ``bidict.OVERWRITE`` and ``bidict.IGNORE``.
A :class:`UserWarning` will now be emitted if these are used.
:attr:`bidict.DROP_OLD` and :attr:`bidict.DROP_NEW` should be used instead.
* Rename ``DuplicationPolicy`` to :class:`~bidict.OnDupAction`
(and implement it via an :class:`~enum.Enum`).
A :class:`~bidict.OnDupAction` may be one of
:attr:`~bidict.RAISE`,
:attr:`~bidict.DROP_OLD`, or
:attr:`~bidict.DROP_NEW`.
* Expose the new :class:`~bidict.OnDup` class,
a named (*key*, *val*, *kv*) tuple of :class:`~bidict.OnDupAction`\s
that should be taken upon encountering
the 3 kinds of duplication that can occur.
* Provide the
:attr:`~bidict.ON_DUP_DEFAULT`,
:attr:`~bidict.ON_DUP_RAISE`, and
:attr:`~bidict.ON_DUP_DROP_OLD`
:class:`~bidict.OnDup` convenience instances.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv`` arguments
of :meth:`~bidict.bidict.put` and :meth:`~bidict.bidict.putall`.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new *on_dup* argument,
which takes an :class:`~bidict.OnDup` instance.
Use it like this: ``bi.put(1, 2, OnDup(key=DROP_NEW))``.
Or better yet, pass one of the
``ON_DUP_*`` convenience instances
instead if possible.
See the updated :ref:`basic-usage:Values Must Be Unique` docs for more info.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv``
bidict class attributes.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new
:attr:`~bidict.bidict.on_dup` class attribute,
which takes an :class:`~bidict.OnDup` instance.
See the updated :doc:`extending` docs for example usage.
* Move
:meth:`bidict.BidictBase.values` to
:meth:`bidict.BidirectionalMapping.values`,
since the implementation is generic.
* No longer use ``__all__`` in ``bidict/__init__.py``.
* Cap max_size rather than disabling health checks and deadline as a
less heavyhanded way to improve hypothesis test reliability on Travis.
2020-01-07 22:20:20 +00:00
|
|
|
DEADLINE_DEFAULT = 200
|
|
|
|
|
2019-09-15 18:19:00 +00:00
|
|
|
SETTINGS = {
|
2018-12-29 18:13:04 +00:00
|
|
|
'max_examples': int(getenv('HYPOTHESIS_MAX_EXAMPLES') or MAX_EXAMPLES_DEFAULT),
|
Various API changes and other improvements.
* Deprecate ``bidict.OVERWRITE`` and ``bidict.IGNORE``.
A :class:`UserWarning` will now be emitted if these are used.
:attr:`bidict.DROP_OLD` and :attr:`bidict.DROP_NEW` should be used instead.
* Rename ``DuplicationPolicy`` to :class:`~bidict.OnDupAction`
(and implement it via an :class:`~enum.Enum`).
A :class:`~bidict.OnDupAction` may be one of
:attr:`~bidict.RAISE`,
:attr:`~bidict.DROP_OLD`, or
:attr:`~bidict.DROP_NEW`.
* Expose the new :class:`~bidict.OnDup` class,
a named (*key*, *val*, *kv*) tuple of :class:`~bidict.OnDupAction`\s
that should be taken upon encountering
the 3 kinds of duplication that can occur.
* Provide the
:attr:`~bidict.ON_DUP_DEFAULT`,
:attr:`~bidict.ON_DUP_RAISE`, and
:attr:`~bidict.ON_DUP_DROP_OLD`
:class:`~bidict.OnDup` convenience instances.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv`` arguments
of :meth:`~bidict.bidict.put` and :meth:`~bidict.bidict.putall`.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new *on_dup* argument,
which takes an :class:`~bidict.OnDup` instance.
Use it like this: ``bi.put(1, 2, OnDup(key=DROP_NEW))``.
Or better yet, pass one of the
``ON_DUP_*`` convenience instances
instead if possible.
See the updated :ref:`basic-usage:Values Must Be Unique` docs for more info.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv``
bidict class attributes.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new
:attr:`~bidict.bidict.on_dup` class attribute,
which takes an :class:`~bidict.OnDup` instance.
See the updated :doc:`extending` docs for example usage.
* Move
:meth:`bidict.BidictBase.values` to
:meth:`bidict.BidirectionalMapping.values`,
since the implementation is generic.
* No longer use ``__all__`` in ``bidict/__init__.py``.
* Cap max_size rather than disabling health checks and deadline as a
less heavyhanded way to improve hypothesis test reliability on Travis.
2020-01-07 22:20:20 +00:00
|
|
|
'deadline': timedelta(milliseconds=int(getenv('HYPOTHESIS_DEADLINE') or DEADLINE_DEFAULT)),
|
2018-12-29 18:13:04 +00:00
|
|
|
}
|
2019-09-15 18:19:00 +00:00
|
|
|
settings.register_profile('custom', **SETTINGS)
|
|
|
|
settings.load_profile('custom')
|