asserts
Advanced tools
| The MIT License (MIT) | ||
| Copyright (c) 2014 Sebastian Rittau | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| this software and associated documentation files (the "Software"), to deal in | ||
| the Software without restriction, including without limitation the rights to | ||
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| the Software, and to permit persons to whom the Software is furnished to do so, | ||
| subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| Metadata-Version: 2.1 | ||
| Name: asserts | ||
| Version: 0.9.1 | ||
| Summary: Stand-alone Assertions | ||
| Home-page: https://github.com/srittau/python-asserts | ||
| Author: Sebastian Rittau | ||
| Author-email: srittau@rittau.biz | ||
| License: MIT | ||
| Platform: UNKNOWN | ||
| Classifier: Development Status :: 3 - Alpha | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: MIT License | ||
| Classifier: Programming Language :: Python :: 2 | ||
| Classifier: Programming Language :: Python :: 2.7 | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Classifier: Programming Language :: Python :: 3.4 | ||
| Classifier: Programming Language :: Python :: 3.5 | ||
| Classifier: Programming Language :: Python :: 3.6 | ||
| Classifier: Programming Language :: Python :: 3.7 | ||
| Classifier: Topic :: Software Development :: Quality Assurance | ||
| Classifier: Topic :: Software Development :: Testing | ||
| Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* | ||
| Python Asserts | ||
| ============== | ||
| .. image:: https://img.shields.io/pypi/l/asserts.svg | ||
| :target: https://pypi.python.org/pypi/asserts/ | ||
| .. image:: https://img.shields.io/github/release/srittau/python-asserts/all.svg | ||
| :target: https://github.com/srittau/python-asserts/releases/ | ||
| .. image:: https://img.shields.io/pypi/v/asserts.svg | ||
| :target: https://pypi.python.org/pypi/asserts/ | ||
| .. image:: https://travis-ci.org/srittau/python-asserts.svg?branch=master | ||
| :target: https://travis-ci.org/srittau/python-asserts | ||
| Stand-alone Assertions for Python | ||
| This package provides a few advantages over the assertions provided by | ||
| unittest.TestCase: | ||
| * Can be used stand-alone, for example: | ||
| * In test cases, not derived from TestCase. | ||
| * In fake and mock classes. | ||
| * In implementations as rich alternative to the assert statement. | ||
| * PEP 8 compliance. | ||
| * Custom stand-alone assertions can be written easily. | ||
| * Arguably a better separation of concerns, since TestCase is responsible | ||
| for test running only, if assertion functions are used exclusively. | ||
| There are a few regressions compared to assertions from TestCase: | ||
| * The default assertion class (AssertionError) can not be overwritten. This | ||
| is rarely a problem in practice. | ||
| * asserts does not support the addTypeEqualityFunc() functionality. | ||
| Usage: | ||
| >>> from asserts import assert_true, assert_equal, assert_raises | ||
| >>> my_var = 13 | ||
| >>> assert_equal(13, my_var) | ||
| >>> assert_true(True, msg="custom failure message") | ||
| >>> with assert_raises(KeyError): | ||
| ... raise KeyError() | ||
| Failure messages can be customized: | ||
| >>> assert_equal(13, 14, msg_fmt="{got} is wrong, expected {expected}") | ||
| Traceback (most recent call last): | ||
| ... | ||
| AssertionError: 14 is wrong, expected 13 | ||
| asserts/__init__.py,sha256=tmy7BRycylMSH1HW80bY8tWfLebDpxc1RWQGh-nfx_g,46625 | ||
| asserts/__init__.pyi,sha256=__RUhSRXwr0X2L4AGimLUZxDXvuvUKCyLlKP6XgUDb8,4959 | ||
| asserts/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | ||
| asserts-0.9.1.dist-info/LICENSE,sha256=lnpupgjKL_g2d4MvBlkaarYrbSpTVVbDoB8QXZffS-k,1083 | ||
| asserts-0.9.1.dist-info/METADATA,sha256=K8jSj2-gbK5xCWTcWBgOPJi24o59UCItyyYu3RYWxtU,2601 | ||
| asserts-0.9.1.dist-info/WHEEL,sha256=HX-v9-noUkyUoxyZ1PMSuS7auUxDAR4VBdoYLqD0xws,110 | ||
| asserts-0.9.1.dist-info/top_level.txt,sha256=spq0DBKMgLrtKtxTqWdr2Djd6YUkm-GSkNuHFObf9oo,8 | ||
| asserts-0.9.1.dist-info/RECORD,, |
| Wheel-Version: 1.0 | ||
| Generator: bdist_wheel (0.33.1) | ||
| Root-Is-Purelib: true | ||
| Tag: py2-none-any | ||
| Tag: py3-none-any | ||
+157
-71
@@ -198,3 +198,4 @@ """ | ||
| def assert_almost_equal( | ||
| first, second, msg_fmt="{msg}", places=None, delta=None): | ||
| first, second, msg_fmt="{msg}", places=None, delta=None | ||
| ): | ||
| """Fail if first and second are not equal after rounding. | ||
@@ -241,8 +242,12 @@ | ||
| msg = "{!r} != {!r} {}".format(first, second, detail_msg) | ||
| fail(msg_fmt.format(msg=msg, first=first, second=second, | ||
| places=places, delta=delta)) | ||
| fail( | ||
| msg_fmt.format( | ||
| msg=msg, first=first, second=second, places=places, delta=delta | ||
| ) | ||
| ) | ||
| def assert_not_almost_equal(first, second, msg_fmt="{msg}", | ||
| places=None, delta=None): | ||
| def assert_not_almost_equal( | ||
| first, second, msg_fmt="{msg}", places=None, delta=None | ||
| ): | ||
| """Fail if first and second are equal after rounding. | ||
@@ -295,8 +300,12 @@ | ||
| msg = "{!r} == {!r} {}".format(first, second, detail_msg) | ||
| fail(msg_fmt.format(msg=msg, first=first, second=second, | ||
| places=places, delta=delta)) | ||
| fail( | ||
| msg_fmt.format( | ||
| msg=msg, first=first, second=second, places=places, delta=delta | ||
| ) | ||
| ) | ||
| def assert_dict_equal(first, second, key_msg_fmt="{msg}", | ||
| value_msg_fmt="{msg}"): | ||
| def assert_dict_equal( | ||
| first, second, key_msg_fmt="{msg}", value_msg_fmt="{msg}" | ||
| ): | ||
| """Fail unless first dictionary equals second. | ||
@@ -337,3 +346,5 @@ | ||
| if len(missing_keys) == 1: | ||
| msg = "key {!r} missing from right dict".format(missing_keys[0]) | ||
| msg = "key {!r} missing from right dict".format( | ||
| missing_keys[0] | ||
| ) | ||
| else: | ||
@@ -350,4 +361,8 @@ keys = ", ".join(sorted(repr(k) for k in missing_keys)) | ||
| msg = key_msg_fmt.format( | ||
| msg=msg, first=first, second=second, | ||
| missing_keys=missing_keys, extra_keys=extra_keys) | ||
| msg=msg, | ||
| first=first, | ||
| second=second, | ||
| missing_keys=missing_keys, | ||
| extra_keys=extra_keys, | ||
| ) | ||
| raise AssertionError(msg) | ||
@@ -358,7 +373,13 @@ for key in first: | ||
| msg = "key '{}' differs: {!r} != {!r}".format( | ||
| key, first_value, second_value) | ||
| key, first_value, second_value | ||
| ) | ||
| if value_msg_fmt: | ||
| msg = value_msg_fmt.format( | ||
| msg=msg, first=first, second=second, | ||
| key=key, first_value=first_value, second_value=second_value) | ||
| msg=msg, | ||
| first=first, | ||
| second=second, | ||
| key=key, | ||
| first_value=first_value, | ||
| second_value=second_value, | ||
| ) | ||
| msg = msg.replace("{", "{{").replace("}", "}}") | ||
@@ -368,4 +389,5 @@ assert_equal(first_value, second_value, msg_fmt=msg) | ||
| def assert_dict_superset(first, second, key_msg_fmt="{msg}", | ||
| value_msg_fmt="{msg}"): | ||
| def assert_dict_superset( | ||
| first, second, key_msg_fmt="{msg}", value_msg_fmt="{msg}" | ||
| ): | ||
| """Fail unless second dictionary is a superset of the first. | ||
@@ -410,3 +432,4 @@ | ||
| msg = key_msg_fmt.format( | ||
| msg=msg, first=first, second=second, missing_keys=missing_keys) | ||
| msg=msg, first=first, second=second, missing_keys=missing_keys | ||
| ) | ||
| raise AssertionError(msg) | ||
@@ -417,7 +440,13 @@ for key in first: | ||
| msg = "key '{}' differs: {!r} != {!r}".format( | ||
| key, first_value, second_value) | ||
| key, first_value, second_value | ||
| ) | ||
| if value_msg_fmt: | ||
| msg = value_msg_fmt.format( | ||
| msg=msg, first=first, second=second, | ||
| key=key, first_value=first_value, second_value=second_value) | ||
| msg=msg, | ||
| first=first, | ||
| second=second, | ||
| key=key, | ||
| first_value=first_value, | ||
| second_value=second_value, | ||
| ) | ||
| msg = msg.replace("{", "{{").replace("}", "}}") | ||
@@ -516,3 +545,3 @@ assert_equal(first_value, second_value, msg_fmt=msg) | ||
| >>> assert_regex("Hello World!", r"llo.*rld!$") | ||
| >>> assert_regex("Hello World!", r"\d") | ||
| >>> assert_regex("Hello World!", r"\\d") | ||
| Traceback (most recent call last): | ||
@@ -657,3 +686,4 @@ ... | ||
| msg += "missing from sequence 1: " + ", ".join( | ||
| repr(i) for i in missing_from_1) | ||
| repr(i) for i in missing_from_1 | ||
| ) | ||
| if missing_from_1 and missing_from_2: | ||
@@ -663,3 +693,4 @@ msg += "; " | ||
| msg += "missing from sequence 2: " + ", ".join( | ||
| repr(i) for i in missing_from_2) | ||
| repr(i) for i in missing_from_2 | ||
| ) | ||
| return msg | ||
@@ -669,4 +700,7 @@ | ||
| if missing_from_1 or missing_from_2: | ||
| fail(msg_fmt.format( | ||
| msg=build_message(), first=sequence1, second=sequence2)) | ||
| fail( | ||
| msg_fmt.format( | ||
| msg=build_message(), first=sequence1, second=sequence2 | ||
| ) | ||
| ) | ||
@@ -693,5 +727,9 @@ | ||
| msg = "{!r} is not between {} and {}".format( | ||
| expr, lower_bound, upper_bound) | ||
| fail(msg_fmt.format(msg=msg, lower=lower_bound, upper=upper_bound, | ||
| expr=expr)) | ||
| expr, lower_bound, upper_bound | ||
| ) | ||
| fail( | ||
| msg_fmt.format( | ||
| msg=msg, lower=lower_bound, upper=upper_bound, expr=expr | ||
| ) | ||
| ) | ||
@@ -716,4 +754,5 @@ | ||
| msg = "{!r} is an instance of {!r}, expected {!r}".format( | ||
| obj, obj.__class__, cls) | ||
| types = cls if isinstance(cls, tuple) else (cls, ) | ||
| obj, obj.__class__, cls | ||
| ) | ||
| types = cls if isinstance(cls, tuple) else (cls,) | ||
| fail(msg_fmt.format(msg=msg, obj=obj, types=types)) | ||
@@ -877,4 +916,6 @@ | ||
| return self.msg_fmt.format( | ||
| msg=default_msg, exc_type=self._exc_type, | ||
| exc_name=self._exception_name) | ||
| msg=default_msg, | ||
| exc_type=self._exc_type, | ||
| exc_name=self._exception_name, | ||
| ) | ||
@@ -902,4 +943,8 @@ def add_test(self, cb): | ||
| return self.msg_fmt.format( | ||
| msg=default_msg, exc_type=self._exc_type, | ||
| exc_name=self._exception_name, pattern=self.pattern, text="") | ||
| msg=default_msg, | ||
| exc_type=self._exc_type, | ||
| exc_name=self._exception_name, | ||
| pattern=self.pattern, | ||
| text="", | ||
| ) | ||
@@ -917,5 +962,8 @@ | ||
| return self.msg_fmt.format( | ||
| msg=default_msg, exc_type=self._exc_type, | ||
| msg=default_msg, | ||
| exc_type=self._exc_type, | ||
| exc_name=self._exception_name, | ||
| expected_errno=self.expected_errno, actual_errno=None) | ||
| expected_errno=self.expected_errno, | ||
| actual_errno=None, | ||
| ) | ||
@@ -959,6 +1007,6 @@ | ||
| >>> with assert_raises_regex(ValueError, r"\d+"): | ||
| >>> with assert_raises_regex(ValueError, r"\\d+"): | ||
| ... raise ValueError("Error #42") | ||
| ... | ||
| >>> with assert_raises_regex(ValueError, r"\d+"): | ||
| >>> with assert_raises_regex(ValueError, r"\\d+"): | ||
| ... raise ValueError("Generic Error") | ||
@@ -982,11 +1030,23 @@ ... | ||
| msg = "{} without message".format(exception.__name__) | ||
| fail(msg_fmt.format( | ||
| msg=msg, text=None, pattern=compiled.pattern, | ||
| exc_type=exception, exc_name=exception.__name__)) | ||
| fail( | ||
| msg_fmt.format( | ||
| msg=msg, | ||
| text=None, | ||
| pattern=compiled.pattern, | ||
| exc_type=exception, | ||
| exc_name=exception.__name__, | ||
| ) | ||
| ) | ||
| text = exc.args[0] | ||
| if not compiled.search(text): | ||
| msg = "{!r} does not match {!r}".format(text, compiled.pattern) | ||
| fail(msg_fmt.format( | ||
| msg=msg, text=text, pattern=compiled.pattern, | ||
| exc_type=exception, exc_name=exception.__name__)) | ||
| fail( | ||
| msg_fmt.format( | ||
| msg=msg, | ||
| text=text, | ||
| pattern=compiled.pattern, | ||
| exc_type=exception, | ||
| exc_name=exception.__name__, | ||
| ) | ||
| ) | ||
@@ -1023,5 +1083,12 @@ context = AssertRaisesRegexContext(exception, regex, msg_fmt) | ||
| msg = "wrong errno: {!r} != {!r}".format(errno, exc.errno) | ||
| fail(msg_fmt.format(msg=msg, exc_type=exception, | ||
| exc_name=exception.__name__, | ||
| expected_errno=errno, actual_errno=exc.errno)) | ||
| fail( | ||
| msg_fmt.format( | ||
| msg=msg, | ||
| exc_type=exception, | ||
| exc_name=exception.__name__, | ||
| expected_errno=errno, | ||
| actual_errno=exc.errno, | ||
| ) | ||
| ) | ||
| context = AssertRaisesErrnoContext(exception, errno, msg_fmt) | ||
@@ -1066,3 +1133,2 @@ context.add_test(check_errno) | ||
| class _AssertSucceeds(object): | ||
| def __enter__(self): | ||
@@ -1074,5 +1140,10 @@ pass | ||
| msg = exception.__name__ + " was unexpectedly raised" | ||
| fail(msg_fmt.format( | ||
| msg=msg, exc_type=exception, exc_name=exception.__name__, | ||
| exception=exc_val)) | ||
| fail( | ||
| msg_fmt.format( | ||
| msg=msg, | ||
| exc_type=exception, | ||
| exc_name=exception.__name__, | ||
| exception=exc_val, | ||
| ) | ||
| ) | ||
@@ -1130,4 +1201,6 @@ return _AssertSucceeds() | ||
| return self._msg_fmt.format( | ||
| msg=msg, exc_type=self._warning_class, | ||
| exc_name=self._warning_class.__name__) | ||
| msg=msg, | ||
| exc_type=self._warning_class, | ||
| exc_name=self._warning_class.__name__, | ||
| ) | ||
@@ -1159,8 +1232,11 @@ def _is_expected_warning(self, warning): | ||
| def format_message(self): | ||
| msg = "no {} matching {} issued".format(self._warning_class.__name__, | ||
| repr(self.pattern)) | ||
| msg = "no {} matching {} issued".format( | ||
| self._warning_class.__name__, repr(self.pattern) | ||
| ) | ||
| return self._msg_fmt.format( | ||
| msg=msg, exc_type=self._warning_class, | ||
| msg=msg, | ||
| exc_type=self._warning_class, | ||
| exc_name=self._warning_class.__name__, | ||
| pattern=self.pattern) | ||
| pattern=self.pattern, | ||
| ) | ||
@@ -1204,3 +1280,3 @@ | ||
| >>> from warnings import warn | ||
| >>> with assert_warns_regex(UserWarning, r"#\d+"): | ||
| >>> with assert_warns_regex(UserWarning, r"#\\d+"): | ||
| ... warn("Error #42", UserWarning) | ||
@@ -1233,3 +1309,3 @@ ... | ||
| else: | ||
| _Str = unicode | ||
| _Str = unicode # noqa: F821 | ||
@@ -1285,4 +1361,7 @@ | ||
| if not isinstance(parsed_second, (dict, list)): | ||
| raise AssertionError("second must decode to dict or list, not {}". | ||
| format(type(parsed_second))) | ||
| raise AssertionError( | ||
| "second must decode to dict or list, not {}".format( | ||
| type(parsed_second) | ||
| ) | ||
| ) | ||
@@ -1351,3 +1430,4 @@ comparer = _JSONComparer(_JSONPath("$"), first, parsed_second) | ||
| self._raise_assertion_error( | ||
| "element {path} differs: {expected} != {actual}") | ||
| "element {path} differs: {expected} != {actual}" | ||
| ) | ||
@@ -1359,3 +1439,4 @@ def _raise_different_sizes(self): | ||
| expected_len=len(self._expected), | ||
| actual_len=len(self._actual)) | ||
| actual_len=len(self._actual), | ||
| ) | ||
@@ -1369,12 +1450,17 @@ def _raise_missing_element(self, keys): | ||
| sorted_keys = sorted(keys) | ||
| elements = (", ".join(repr(k) for k in sorted_keys[:-1]) + | ||
| ", and " + repr(sorted_keys[-1])) | ||
| elements = ( | ||
| ", ".join(repr(k) for k in sorted_keys[:-1]) | ||
| + ", and " | ||
| + repr(sorted_keys[-1]) | ||
| ) | ||
| self._raise_assertion_error(format_string, elements=elements) | ||
| def _raise_assertion_error(self, format_, **kwargs): | ||
| kwargs.update({ | ||
| "path": self._path, | ||
| "expected": repr(self._expected), | ||
| "actual": repr(self._actual), | ||
| }) | ||
| kwargs.update( | ||
| { | ||
| "path": self._path, | ||
| "expected": repr(self._expected), | ||
| "actual": repr(self._actual), | ||
| } | ||
| ) | ||
| raise AssertionError(format_.format(**kwargs)) | ||
@@ -1381,0 +1467,0 @@ |
+32
-15
| import datetime | ||
| from types import TracebackType | ||
| from typing import \ | ||
| Any, Container, Type, Callable, Tuple, Union, ContextManager, \ | ||
| Pattern, Optional, Iterable, Text, NoReturn | ||
| from typing import ( | ||
| Any, | ||
| Callable, | ||
| Container, | ||
| ContextManager, | ||
| Generic, | ||
| Iterable, | ||
| NoReturn, | ||
| Optional, | ||
| Pattern, | ||
| Text, | ||
| Tuple, | ||
| Type, | ||
| TypeVar, | ||
| Union, | ||
| ) | ||
| class AssertRaisesContext: | ||
| exception: Type[BaseException] | ||
| _E = TypeVar("_E", bound=BaseException) | ||
| class AssertRaisesContext(Generic[_E]): | ||
| exception: Type[_E] | ||
| msg_fmt: Text | ||
| def __init__(self, exception: Type[BaseException], msg_fmt: Text = ...) -> None: ... | ||
| def __init__(self, exception: Type[_E], msg_fmt: Text = ...) -> None: ... | ||
| def __enter__(self) -> AssertRaisesContext: ... | ||
| def __exit__(self, exc_type: Optional[Type[BaseException]], | ||
| exc_val: Optional[BaseException], | ||
| exc_tb: Optional[TracebackType]) -> Optional[bool]: ... | ||
| def __exit__( | ||
| self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] | ||
| ) -> Optional[bool]: ... | ||
| def format_message(self, default_msg: Text) -> Text: ... | ||
| def add_test(self, cb: Callable[[BaseException], None]) -> None: ... | ||
| def add_test(self, cb: Callable[[_E], None]) -> None: ... | ||
| class AssertRaisesErrnoContext(AssertRaisesContext): | ||
| class AssertRaisesErrnoContext(AssertRaisesContext[_E]): | ||
| expected_errno: int | ||
| def __init__(self, exception: Type[BaseException], expected_errno: int, msg_fmt: Text = ...) -> None: ... | ||
| def __init__(self, exception: Type[_E], expected_errno: int, msg_fmt: Text = ...) -> None: ... | ||
| class AssertRaisesRegexContext(AssertRaisesContext): | ||
| class AssertRaisesRegexContext(AssertRaisesContext[_E]): | ||
| pattern: Text | ||
| def __init__(self, exception: Type[BaseException], pattern: Text, msg_fmt: Text = ...) -> None: ... | ||
| def __init__(self, exception: Type[_E], pattern: Text, msg_fmt: Text = ...) -> None: ... | ||
@@ -68,3 +83,5 @@ class AssertWarnsContext: | ||
| def assert_raises(exception: Type[BaseException], msg_fmt: Text = ...) -> AssertRaisesContext: ... | ||
| def assert_raises_regex(exception: Type[BaseException], regex: Union[Text, Pattern[Text]], msg_fmt: Text = ...) -> AssertRaisesContext: ... | ||
| def assert_raises_regex( | ||
| exception: Type[BaseException], regex: Union[Text, Pattern[Text]], msg_fmt: Text = ... | ||
| ) -> AssertRaisesContext: ... | ||
| def assert_raises_errno(exception: Type[BaseException], errno: int, msg_fmt: Text = ...) -> AssertRaisesContext: ... | ||
@@ -71,0 +88,0 @@ def assert_succeeds(exception: Type[BaseException], msg_fmt: Text = ...) -> ContextManager: ... |
| The MIT License (MIT) | ||
| Copyright (c) 2014 Sebastian Rittau | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| this software and associated documentation files (the "Software"), to deal in | ||
| the Software without restriction, including without limitation the rights to | ||
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| the Software, and to permit persons to whom the Software is furnished to do so, | ||
| subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| Metadata-Version: 2.1 | ||
| Name: asserts | ||
| Version: 0.9.0 | ||
| Summary: Stand-alone Assertions | ||
| Home-page: https://github.com/srittau/python-asserts | ||
| Author: Sebastian Rittau | ||
| Author-email: srittau@rittau.biz | ||
| License: MIT | ||
| Platform: UNKNOWN | ||
| Classifier: Development Status :: 3 - Alpha | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: MIT License | ||
| Classifier: Programming Language :: Python :: 2 | ||
| Classifier: Programming Language :: Python :: 2.7 | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Classifier: Programming Language :: Python :: 3.4 | ||
| Classifier: Programming Language :: Python :: 3.5 | ||
| Classifier: Programming Language :: Python :: 3.6 | ||
| Classifier: Programming Language :: Python :: 3.7 | ||
| Classifier: Topic :: Software Development :: Quality Assurance | ||
| Classifier: Topic :: Software Development :: Testing | ||
| Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* | ||
| Python Asserts | ||
| ============== | ||
| .. image:: https://img.shields.io/pypi/l/asserts.svg | ||
| :target: https://pypi.python.org/pypi/asserts/ | ||
| .. image:: https://img.shields.io/github/release/srittau/python-asserts/all.svg | ||
| :target: https://github.com/srittau/python-asserts/releases/ | ||
| .. image:: https://img.shields.io/pypi/v/asserts.svg | ||
| :target: https://pypi.python.org/pypi/asserts/ | ||
| .. image:: https://travis-ci.org/srittau/python-asserts.svg?branch=master | ||
| :target: https://travis-ci.org/srittau/python-asserts | ||
| Stand-alone Assertions for Python | ||
| This package provides a few advantages over the assertions provided by | ||
| unittest.TestCase: | ||
| * Can be used stand-alone, for example: | ||
| * In test cases, not derived from TestCase. | ||
| * In fake and mock classes. | ||
| * In implementations as rich alternative to the assert statement. | ||
| * PEP 8 compliance. | ||
| * Custom stand-alone assertions can be written easily. | ||
| * Arguably a better separation of concerns, since TestCase is responsible | ||
| for test running only, if assertion functions are used exclusively. | ||
| There are a few regressions compared to assertions from TestCase: | ||
| * The default assertion class (AssertionError) can not be overwritten. This | ||
| is rarely a problem in practice. | ||
| * asserts does not support the addTypeEqualityFunc() functionality. | ||
| Usage: | ||
| >>> from asserts import assert_true, assert_equal, assert_raises | ||
| >>> my_var = 13 | ||
| >>> assert_equal(13, my_var) | ||
| >>> assert_true(True, msg="custom failure message") | ||
| >>> with assert_raises(KeyError): | ||
| ... raise KeyError() | ||
| Failure messages can be customized: | ||
| >>> assert_equal(13, 14, msg_fmt="{got} is wrong, expected {expected}") | ||
| Traceback (most recent call last): | ||
| ... | ||
| AssertionError: 14 is wrong, expected 13 | ||
| asserts/__init__.py,sha256=bZFo_HkNQTPzMWPqbwgbM5Elt2Ja7DVbT2icikTIGk0,45556 | ||
| asserts/__init__.pyi,sha256=Yp1JjX3_B1S44Vw4I_9NsjscovhSY3EOVg6OM7i18fY,4899 | ||
| asserts/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | ||
| asserts-0.9.0.dist-info/LICENSE.txt,sha256=lnpupgjKL_g2d4MvBlkaarYrbSpTVVbDoB8QXZffS-k,1083 | ||
| asserts-0.9.0.dist-info/METADATA,sha256=pk2cUdbya_3rVNudFgMJvOBQr11xRjwqIBVfDBw5Gqw,2601 | ||
| asserts-0.9.0.dist-info/RECORD,, | ||
| asserts-0.9.0.dist-info/WHEEL,sha256=gduuPyBvFJQSQ0zdyxF7k0zynDXbIbvg5ZBHoXum5uk,110 | ||
| asserts-0.9.0.dist-info/top_level.txt,sha256=spq0DBKMgLrtKtxTqWdr2Djd6YUkm-GSkNuHFObf9oo,8 |
| Wheel-Version: 1.0 | ||
| Generator: bdist_wheel (0.31.1) | ||
| Root-Is-Purelib: true | ||
| Tag: py2-none-any | ||
| Tag: py3-none-any | ||
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
55996
2.04%1252
8.87%