%global _empty_manifest_terminate_build 0 Name: python-hypothesis-auto Version: 1.1.5 Release: 1 Summary: Extends Hypothesis to add fully automatic testing of type annotated functions License: MIT URL: https://pypi.org/project/hypothesis-auto/ Source0: https://mirrors.nju.edu.cn/pypi/web/packages/14/9d/a491aaf55e61b4fee99508d8d2ede409c760ced3e0156d78bcbd34a8e4df/hypothesis_auto-1.1.5.tar.gz BuildArch: noarch Requires: python3-pydantic Requires: python3-hypothesis Requires: python3-pytest %description 3 0/0 ZeroDivisionError: division by zero auto_test(divide, auto_allow_exceptions_=(ZeroDivisionError, )) ``` #### Using `auto_test` with a custom verification method: ```python3 from hypothesis_auto import Scenario, auto_test def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 def my_custom_verifier(scenario: Scenario): if scenario.kwargs["number_1"] > 0 and scenario.kwargs["number_2"] > 0: assert scenario.result > scenario.kwargs["number_1"] assert scenario.result > scenario.kwargs["number_2"] elif scenario.kwargs["number_1"] < 0 and scenario.kwargs["number_2"] < 0: assert scenario.result < scenario.kwargs["number_1"] assert scenario.result < scenario.kwargs["number_2"] else: assert scenario.result >= min(scenario.kwargs.values()) assert scenario.result <= max(scenario.kwargs.values()) auto_test(add, auto_verify_=my_custom_verifier) ``` Custom verification methods should take a single [Scenario](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/tester/#scenario) and raise an exception to signify errors. For the full set of parameters, you can pass into auto_test see its [API reference documentation](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/tester/). ### pytest usage #### Using `auto_pytest_magic` to auto-generate dozens of pytest test cases: ```python3 from hypothesis_auto import auto_pytest_magic def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 auto_pytest_magic(add) ``` #### Using `auto_pytest` to run dozens of test case within a temporary directory: ```python3 from hypothesis_auto import auto_pytest def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 @auto_pytest() def test_add(test_case, tmpdir): tmpdir.mkdir().chdir() test_case() ``` #### Using `auto_pytest_magic` with a custom verification method: ```python3 from hypothesis_auto import Scenario, auto_pytest def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 def my_custom_verifier(scenario: Scenario): if scenario.kwargs["number_1"] > 0 and scenario.kwargs["number_2"] > 0: assert scenario.result > scenario.kwargs["number_1"] assert scenario.result > scenario.kwargs["number_2"] elif scenario.kwargs["number_1"] < 0 and scenario.kwargs["number_2"] < 0: assert scenario.result < scenario.kwargs["number_1"] assert scenario.result < scenario.kwargs["number_2"] else: assert scenario.result >= min(scenario.kwargs.values()) assert scenario.result <= max(scenario.kwargs.values()) auto_pytest_magic(add, auto_verify_=my_custom_verifier) ``` Custom verification methods should take a single [Scenario](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/tester/#scenario) and raise an exception to signify errors. For the full reference of the pytest integration API see the [API reference documentation](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/pytest/). ## Why Create hypothesis-auto? I wanted a no/low resistance way to start incorporating property-based tests across my projects. Such a solution that also encouraged the use of type hints was a win/win for me. I hope you too find `hypothesis-auto` useful! ~Timothy Crosley %package -n python3-hypothesis-auto Summary: Extends Hypothesis to add fully automatic testing of type annotated functions Provides: python-hypothesis-auto BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-hypothesis-auto 3 0/0 ZeroDivisionError: division by zero auto_test(divide, auto_allow_exceptions_=(ZeroDivisionError, )) ``` #### Using `auto_test` with a custom verification method: ```python3 from hypothesis_auto import Scenario, auto_test def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 def my_custom_verifier(scenario: Scenario): if scenario.kwargs["number_1"] > 0 and scenario.kwargs["number_2"] > 0: assert scenario.result > scenario.kwargs["number_1"] assert scenario.result > scenario.kwargs["number_2"] elif scenario.kwargs["number_1"] < 0 and scenario.kwargs["number_2"] < 0: assert scenario.result < scenario.kwargs["number_1"] assert scenario.result < scenario.kwargs["number_2"] else: assert scenario.result >= min(scenario.kwargs.values()) assert scenario.result <= max(scenario.kwargs.values()) auto_test(add, auto_verify_=my_custom_verifier) ``` Custom verification methods should take a single [Scenario](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/tester/#scenario) and raise an exception to signify errors. For the full set of parameters, you can pass into auto_test see its [API reference documentation](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/tester/). ### pytest usage #### Using `auto_pytest_magic` to auto-generate dozens of pytest test cases: ```python3 from hypothesis_auto import auto_pytest_magic def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 auto_pytest_magic(add) ``` #### Using `auto_pytest` to run dozens of test case within a temporary directory: ```python3 from hypothesis_auto import auto_pytest def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 @auto_pytest() def test_add(test_case, tmpdir): tmpdir.mkdir().chdir() test_case() ``` #### Using `auto_pytest_magic` with a custom verification method: ```python3 from hypothesis_auto import Scenario, auto_pytest def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 def my_custom_verifier(scenario: Scenario): if scenario.kwargs["number_1"] > 0 and scenario.kwargs["number_2"] > 0: assert scenario.result > scenario.kwargs["number_1"] assert scenario.result > scenario.kwargs["number_2"] elif scenario.kwargs["number_1"] < 0 and scenario.kwargs["number_2"] < 0: assert scenario.result < scenario.kwargs["number_1"] assert scenario.result < scenario.kwargs["number_2"] else: assert scenario.result >= min(scenario.kwargs.values()) assert scenario.result <= max(scenario.kwargs.values()) auto_pytest_magic(add, auto_verify_=my_custom_verifier) ``` Custom verification methods should take a single [Scenario](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/tester/#scenario) and raise an exception to signify errors. For the full reference of the pytest integration API see the [API reference documentation](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/pytest/). ## Why Create hypothesis-auto? I wanted a no/low resistance way to start incorporating property-based tests across my projects. Such a solution that also encouraged the use of type hints was a win/win for me. I hope you too find `hypothesis-auto` useful! ~Timothy Crosley %package help Summary: Development documents and examples for hypothesis-auto Provides: python3-hypothesis-auto-doc %description help 3 0/0 ZeroDivisionError: division by zero auto_test(divide, auto_allow_exceptions_=(ZeroDivisionError, )) ``` #### Using `auto_test` with a custom verification method: ```python3 from hypothesis_auto import Scenario, auto_test def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 def my_custom_verifier(scenario: Scenario): if scenario.kwargs["number_1"] > 0 and scenario.kwargs["number_2"] > 0: assert scenario.result > scenario.kwargs["number_1"] assert scenario.result > scenario.kwargs["number_2"] elif scenario.kwargs["number_1"] < 0 and scenario.kwargs["number_2"] < 0: assert scenario.result < scenario.kwargs["number_1"] assert scenario.result < scenario.kwargs["number_2"] else: assert scenario.result >= min(scenario.kwargs.values()) assert scenario.result <= max(scenario.kwargs.values()) auto_test(add, auto_verify_=my_custom_verifier) ``` Custom verification methods should take a single [Scenario](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/tester/#scenario) and raise an exception to signify errors. For the full set of parameters, you can pass into auto_test see its [API reference documentation](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/tester/). ### pytest usage #### Using `auto_pytest_magic` to auto-generate dozens of pytest test cases: ```python3 from hypothesis_auto import auto_pytest_magic def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 auto_pytest_magic(add) ``` #### Using `auto_pytest` to run dozens of test case within a temporary directory: ```python3 from hypothesis_auto import auto_pytest def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 @auto_pytest() def test_add(test_case, tmpdir): tmpdir.mkdir().chdir() test_case() ``` #### Using `auto_pytest_magic` with a custom verification method: ```python3 from hypothesis_auto import Scenario, auto_pytest def add(number_1: int, number_2: int = 1) -> int: return number_1 + number_2 def my_custom_verifier(scenario: Scenario): if scenario.kwargs["number_1"] > 0 and scenario.kwargs["number_2"] > 0: assert scenario.result > scenario.kwargs["number_1"] assert scenario.result > scenario.kwargs["number_2"] elif scenario.kwargs["number_1"] < 0 and scenario.kwargs["number_2"] < 0: assert scenario.result < scenario.kwargs["number_1"] assert scenario.result < scenario.kwargs["number_2"] else: assert scenario.result >= min(scenario.kwargs.values()) assert scenario.result <= max(scenario.kwargs.values()) auto_pytest_magic(add, auto_verify_=my_custom_verifier) ``` Custom verification methods should take a single [Scenario](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/tester/#scenario) and raise an exception to signify errors. For the full reference of the pytest integration API see the [API reference documentation](https://timothycrosley.github.io/hypothesis-auto/reference/hypothesis_auto/pytest/). ## Why Create hypothesis-auto? I wanted a no/low resistance way to start incorporating property-based tests across my projects. Such a solution that also encouraged the use of type hints was a win/win for me. I hope you too find `hypothesis-auto` useful! ~Timothy Crosley %prep %autosetup -n hypothesis-auto-1.1.5 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-hypothesis-auto -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Apr 25 2023 Python_Bot - 1.1.5-1 - Package Spec generated