Package: insist
insist======An easy-to-use assertion library for python.Quick Start===========Install insist--------------```$ pip install insist```or```$ sudo pip install insist```Create Insist object--------------------```pythonfrom insist import Insistinsist = Insist()# Raise RuntimeError instead of AssertionErrorinsist_rt = Insist(RuntimeError)# Prefix all messages with "OOPS : "insist_prefix = Insist(message_prefix="OOPS")# Show both custom and standard error messages# Can be combined with message_prefixinsist_both = Insist(always_show_standard=True)```Make assertions---------------```pythoninsist.true(1 == 1)   # Valid assertioninsist(1 == 1)        # Same as insist.true(expr)insist(1 == 2)        # Raises AssertionError# Raises AssertionError with custom error messageinsist(1 == 2, "Danger, Will Robinson")# Raises AssertionError with custom and standard error message joined with " : "insist_both(1 == 2, "Danger, Will Robinson")```Reference=========All tests---------```pythonfrom insist import Insistinsist = Insist()insist(x)                     # x == Trueinsist.true(x)                # x == Trueinsist.false(x)               # x == Falseinsist.always(custom)         # Always raise an errorinsist.equal(x, y)            # x == yinsist.not_equal(x, y)        # x != yinsist.less(x, y)             # x < yinsist.less_equal(x, y)       # x <= yinsist.greater(x, y)          # x > yinsist.greater_equal(x, y)    # x >= yinsist.is_same(x, y)          # x is yinsist.is_not(x, y)           # x is not yinsist.is_in(x, y)            # x in yinsist.not_in(x, y)           # x not in yinsist.is_subclass(x, y)      # issubclass(x, y)insist.is_not_subclass(x, y)  # not issubclass(x, y)insist.isa(x, y)              # isinstance(x, y)insist.is_not_a(x, y)         # not isinstance(x, y)insist.is_string(x, y)        # isinstance(x, str) for Py3# isinstance(x, (str, unicode)) for Py2insist.is_not_string(x, y)    # not isinstance(x, str) for Py3# not isinstance(x, (str, unicode)) for Py2insist.keys(x, required, optional, extra, custom)   # See examples below# Dict used for remaining examplesx = { 'a' : 1, 'b' : 2, 'c' : 3 }# Require that x has listed keys with additional keys allowed.insist.keys(x, required=['a', 'b'])   # OKinsist.keys(x, required=['a', 'd'])   # Raises error# Require that x has listed keys with additional keys not allowed.insist.keys(x, required=['a', 'b'], extra=False)  # Raises error# Require that x has listed keys but no keys other than optional keys allowed.insist.keys(x, required=['a', 'b'], optional=['c'])  # OKinsist.keys(x, required=['a', 'b'], optional=['d'])  # Raises error```Chainable Tests---------------The "that" method retains its value and uses it as the first value for the remaining methods in chain.This simplifies the testing of a single value against multiple criteria.```pythonfrom insist import Insistinsist = Insist()x = 3insist.that(x).isa(int).greater_equal(0).less(10)   # OK if x is integer from 0 to 9# The result of the "that" method may be stored in a variable as well.say_x = insist.that(x)say_x.isa(int).greater_equal(0)say_x.less(len(message))# In addition to the methods listed above, a "that chain" has two additional methods.# The has and not_has methods are similar to is_in and not_in except that the# arguments are reversed.x = [ 1, 2, 3 ]say_x = insist.that(x)say_x.has(1).has(2)        # OKsay_x.has(1).not_has(2)    # Raises errorsay_x.has(1).has(5)        # Raises errorx = { 'a' : 1, 'b' : 2, 'c' : 3 }say_x = insist.that(x)say_x.has('a').has('b')    # OKsay_x.has('a').has('d')    # Raises error```Copyright and License=====================Copyright 2014 Ray HarrisLicensed under the Apache License, Version 2.0 (the "License");you may not use this module except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.