test-helper-by-delica 0.1.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- test_helper_by_delica-0.1.dev1/.github/workflows/main.yml +77 -0
- test_helper_by_delica-0.1.dev1/LICENSE +21 -0
- test_helper_by_delica-0.1.dev1/PKG-INFO +25 -0
- test_helper_by_delica-0.1.dev1/README.md +12 -0
- test_helper_by_delica-0.1.dev1/pyproject.toml +23 -0
- test_helper_by_delica-0.1.dev1/requirements.txt +0 -0
- test_helper_by_delica-0.1.dev1/setup.cfg +4 -0
- test_helper_by_delica-0.1.dev1/setup.py +20 -0
- test_helper_by_delica-0.1.dev1/test_helper_by_delica/__init__.py +5 -0
- test_helper_by_delica-0.1.dev1/test_helper_by_delica/test_helper_funcs.py +209 -0
- test_helper_by_delica-0.1.dev1/test_helper_by_delica.egg-info/PKG-INFO +25 -0
- test_helper_by_delica-0.1.dev1/test_helper_by_delica.egg-info/SOURCES.txt +13 -0
- test_helper_by_delica-0.1.dev1/test_helper_by_delica.egg-info/dependency_links.txt +1 -0
- test_helper_by_delica-0.1.dev1/test_helper_by_delica.egg-info/top_level.txt +1 -0
- test_helper_by_delica-0.1.dev1/tests/test_test_helper_funcs.py +34 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: publish-python-to-pypi
|
|
2
|
+
#Workflow Source: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
|
|
3
|
+
|
|
4
|
+
on: push
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
name: Build distribution 📦
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
with:
|
|
14
|
+
persist-credentials: false
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.x"
|
|
19
|
+
- name: Install pypa/build
|
|
20
|
+
run: >-
|
|
21
|
+
python3 -m
|
|
22
|
+
pip install
|
|
23
|
+
build
|
|
24
|
+
--user
|
|
25
|
+
- name: Build a binary wheel and a source tarball
|
|
26
|
+
run: python3 -m build
|
|
27
|
+
- name: Store the distribution packages
|
|
28
|
+
uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: python-package-distributions
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
publish-to-pypi:
|
|
34
|
+
name: >-
|
|
35
|
+
Publish Python 🐍 distribution 📦 to PyPI
|
|
36
|
+
#if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
|
37
|
+
needs:
|
|
38
|
+
- build
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
environment:
|
|
41
|
+
name: pypi
|
|
42
|
+
url: https://pypi.org/p/test_helper_by_delica # Replace <package-name> with your PyPI project name
|
|
43
|
+
permissions:
|
|
44
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
45
|
+
|
|
46
|
+
steps:
|
|
47
|
+
- name: Download all the dists
|
|
48
|
+
uses: actions/download-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: python-package-distributions
|
|
51
|
+
path: dist/
|
|
52
|
+
- name: Publish distribution 📦 to PyPI
|
|
53
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
54
|
+
|
|
55
|
+
# publish-to-testpypi:
|
|
56
|
+
# name: Publish Python 🐍 distribution 📦 to TestPyPI
|
|
57
|
+
# needs:
|
|
58
|
+
# - build
|
|
59
|
+
# runs-on: ubuntu-latest
|
|
60
|
+
|
|
61
|
+
# environment:
|
|
62
|
+
# name: testpypi
|
|
63
|
+
# url: https://test.pypi.org/p/<package-name>
|
|
64
|
+
|
|
65
|
+
# permissions:
|
|
66
|
+
# id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
67
|
+
|
|
68
|
+
# steps:
|
|
69
|
+
# - name: Download all the dists
|
|
70
|
+
# uses: actions/download-artifact@v4
|
|
71
|
+
# with:
|
|
72
|
+
# name: python-package-distributions
|
|
73
|
+
# path: dist/
|
|
74
|
+
# - name: Publish distribution 📦 to TestPyPI
|
|
75
|
+
# uses: pypa/gh-action-pypi-publish@release/v1
|
|
76
|
+
# with:
|
|
77
|
+
# repository-url: https://test.pypi.org/legacy/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 DelicaLM
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: test_helper_by_delica
|
|
3
|
+
Version: 0.1.dev1
|
|
4
|
+
Summary: A Python package that simplifies the creation and execution of unittest test cases.
|
|
5
|
+
Author: Delica Leboe-McGowan
|
|
6
|
+
Author-email: Delica Leboe-McGowan <stormindustries22@outlook.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Dynamic: author
|
|
13
|
+
|
|
14
|
+
# Test-helper-by-delica
|
|
15
|
+
|
|
16
|
+
## Purpose
|
|
17
|
+
|
|
18
|
+
This Python package simplifies the creation and execution of unittest (a widely used library for unit testing) test
|
|
19
|
+
cases, in order to help programmers efficiently develop and run tests for their Python software.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
## Getting Started
|
|
24
|
+
|
|
25
|
+
## Citation
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Test-helper-by-delica
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This Python package simplifies the creation and execution of unittest (a widely used library for unit testing) test
|
|
6
|
+
cases, in order to help programmers efficiently develop and run tests for their Python software.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
## Getting Started
|
|
11
|
+
|
|
12
|
+
## Citation
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "test_helper_by_delica"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
authors = [
|
|
5
|
+
{ name="Delica Leboe-McGowan", email="stormindustries22@outlook.com" },
|
|
6
|
+
]
|
|
7
|
+
|
|
8
|
+
description = "A Python package that simplifies the creation and execution of unittest test cases."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Operating System :: OS Independent",
|
|
14
|
+
]
|
|
15
|
+
license = "MIT"
|
|
16
|
+
license-files = ["LICENCE*"]
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["setuptools >= 77.0.3", "setuptools-scm>=8"]
|
|
20
|
+
build-backend = "setuptools.build_meta"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools_scm]
|
|
23
|
+
local_scheme = "no-local-version"
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
this_directory = Path(__file__).parent
|
|
5
|
+
long_description = (this_directory / "README.md").read_text()
|
|
6
|
+
|
|
7
|
+
setup(
|
|
8
|
+
name='test_helper_by_delica',
|
|
9
|
+
use_scm_version=True,
|
|
10
|
+
setup_requires=['setuptools_scm'],
|
|
11
|
+
description="A Python package that simplifies the creation and execution of unittest test cases.",
|
|
12
|
+
author="Delica Leboe-McGowan",
|
|
13
|
+
author_email="stormindustries22@outlook.com",
|
|
14
|
+
packages=['test_helper_by_delica'],
|
|
15
|
+
install_requires=[
|
|
16
|
+
|
|
17
|
+
],
|
|
18
|
+
long_description=long_description,
|
|
19
|
+
long_description_content_type='text/markdown'
|
|
20
|
+
)
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
from unittest import TestCase
|
|
2
|
+
|
|
3
|
+
def run_single_test(unittest_obj, assert_func, test_func, test_input=(), expected_output=(),
|
|
4
|
+
test_desc=""):
|
|
5
|
+
"""Runs a single test using an unittest TestCase object.
|
|
6
|
+
|
|
7
|
+
Parameters
|
|
8
|
+
----------
|
|
9
|
+
unittest_obj : TestCase
|
|
10
|
+
The unittest TestCase object that should be used to run the test.
|
|
11
|
+
assert_func : function
|
|
12
|
+
The unittest assertion function that should be used to verify the result of the test.
|
|
13
|
+
test_func : function
|
|
14
|
+
The function that should be tested.
|
|
15
|
+
test_input : tuple, default=()
|
|
16
|
+
The input tuple that will be passed to the test function.
|
|
17
|
+
expected_output : tuple, default=()
|
|
18
|
+
The expected output that should be returned by the test function.
|
|
19
|
+
test_desc : str, default=""
|
|
20
|
+
A description of the test that should be printed to stdout.
|
|
21
|
+
|
|
22
|
+
Returns
|
|
23
|
+
-------
|
|
24
|
+
None
|
|
25
|
+
|
|
26
|
+
Raises
|
|
27
|
+
______
|
|
28
|
+
AssertionError
|
|
29
|
+
Raised if the test fails.
|
|
30
|
+
"""
|
|
31
|
+
assert isinstance(unittest_obj, TestCase)
|
|
32
|
+
assert callable(assert_func)
|
|
33
|
+
# test = getattr(TestCase, assert_func.__name__)
|
|
34
|
+
# assert callable(getattr(unittest_obj, assert_func.__name__))
|
|
35
|
+
assert callable(test_func)
|
|
36
|
+
print("Testing " + test_desc)
|
|
37
|
+
input_string = str(test_input)
|
|
38
|
+
expected_output_string = str(expected_output)
|
|
39
|
+
use_assert_raises = False
|
|
40
|
+
error_type = None
|
|
41
|
+
use_assert_raises = False
|
|
42
|
+
if type(expected_output) is type:
|
|
43
|
+
use_assert_raises = issubclass(expected_output, Exception)
|
|
44
|
+
if use_assert_raises:
|
|
45
|
+
error_type = expected_output
|
|
46
|
+
|
|
47
|
+
if use_assert_raises:
|
|
48
|
+
assert error_type is not None
|
|
49
|
+
# error_type = Exception
|
|
50
|
+
# if len(expected_output) > 0:
|
|
51
|
+
# error_type = expected_output[0]
|
|
52
|
+
assert error_type is Exception or issubclass(error_type, Exception)
|
|
53
|
+
with unittest_obj.assertRaises(error_type) as context_manager:
|
|
54
|
+
test_func(*test_input)
|
|
55
|
+
raised_exception = context_manager.exception
|
|
56
|
+
if raised_exception is not None:
|
|
57
|
+
print(f"ERROR MESSAGE: {str(raised_exception)}")
|
|
58
|
+
|
|
59
|
+
else:
|
|
60
|
+
test_output = test_func(*test_input)
|
|
61
|
+
if hasattr(test_output, "__len__"):
|
|
62
|
+
assert len(test_output) == len(expected_output)
|
|
63
|
+
if type(test_output) is tuple:
|
|
64
|
+
assert_func(*test_output, *expected_output)
|
|
65
|
+
else:
|
|
66
|
+
assert_func(test_output, expected_output)
|
|
67
|
+
|
|
68
|
+
# assert_func(test_output, *expected_output)
|
|
69
|
+
print(f"SUCCESS: input={input_string} -> output={expected_output_string}")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def run_func_tests(unittest_obj, assert_func, test_func, input_output_pairs, test_desc=""):
|
|
73
|
+
"""Runs a set of unittest tests for a specified function.
|
|
74
|
+
|
|
75
|
+
Parameters
|
|
76
|
+
----------
|
|
77
|
+
unittest_obj : TestCase
|
|
78
|
+
The unittest TestCase object that should be used to run the tests.
|
|
79
|
+
assert_func : function
|
|
80
|
+
The unittest assertion function that should be used to verify the results of the tests.
|
|
81
|
+
test_func : function
|
|
82
|
+
The function that should be tested.
|
|
83
|
+
input_output_pairs : list
|
|
84
|
+
List of the input/output tuples that should be passed to the test function. The length of this list determines
|
|
85
|
+
the number of tests that will be run.
|
|
86
|
+
test_desc : str, default="",
|
|
87
|
+
A description of the tests that should be printed to stdout.
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
-------
|
|
91
|
+
None
|
|
92
|
+
|
|
93
|
+
Raises
|
|
94
|
+
______
|
|
95
|
+
AssertionError
|
|
96
|
+
Raised if any of the tests fail (stdout messages allow the user to easily determine which test case failed).
|
|
97
|
+
|
|
98
|
+
"""
|
|
99
|
+
assert isinstance(unittest_obj, TestCase)
|
|
100
|
+
assert callable(test_func)
|
|
101
|
+
assert callable(assert_func)
|
|
102
|
+
assert type(input_output_pairs) == list
|
|
103
|
+
assert type(test_desc) == str
|
|
104
|
+
print("TESTING " + test_desc.upper())
|
|
105
|
+
io_pairs = []
|
|
106
|
+
for io_pair in input_output_pairs:
|
|
107
|
+
if io_pair != ():
|
|
108
|
+
io_pairs.append(io_pair)
|
|
109
|
+
num_tests = len(io_pairs)
|
|
110
|
+
test_num = 1
|
|
111
|
+
for io_pair in io_pairs:
|
|
112
|
+
assert type(io_pair) == tuple
|
|
113
|
+
assert len(io_pair) == 1 or len(io_pair) == 2
|
|
114
|
+
test_input = io_pair[0]
|
|
115
|
+
expected_output = ()
|
|
116
|
+
if len(io_pair) == 2:
|
|
117
|
+
expected_output = io_pair[1]
|
|
118
|
+
print(f"Test #{test_num} of {num_tests}")
|
|
119
|
+
run_single_test(unittest_obj, assert_func, test_func, test_input, expected_output,
|
|
120
|
+
f"{test_func.__name__} function for input " + str(test_input))
|
|
121
|
+
test_num += 1
|
|
122
|
+
print(f"ALL {num_tests} TESTS COMPLETED FOR {test_desc.upper()}\n")
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def test_bool_func(unittest_obj, test_func, true_inputs=None, false_inputs=None, error_if_false=False, error_type=Exception,
|
|
126
|
+
test_desc="", success_desc=""):
|
|
127
|
+
"""Runs a set of unittest tests for a function that returns a boolean value.
|
|
128
|
+
|
|
129
|
+
Parameters
|
|
130
|
+
----------
|
|
131
|
+
unittest_obj : TestCase
|
|
132
|
+
The unittest TestCase object that should be used to run the tests.
|
|
133
|
+
test_func : function
|
|
134
|
+
The boolean function that should be tested.
|
|
135
|
+
true_inputs : list
|
|
136
|
+
List of input tuples that should cause the test function to return True.
|
|
137
|
+
false_inputs : list
|
|
138
|
+
List of input tuples that should cause the test function to return False.
|
|
139
|
+
error_if_false : bool, default=False
|
|
140
|
+
Boolean flag for whether the function should raise an error when the condition it evaluates is False.
|
|
141
|
+
error_type : type, default=Exception
|
|
142
|
+
The type of exception that should be raised for False results.
|
|
143
|
+
test_desc : str, default="",
|
|
144
|
+
A description of the tests that should be printed to stdout.
|
|
145
|
+
|
|
146
|
+
Returns
|
|
147
|
+
-------
|
|
148
|
+
None
|
|
149
|
+
|
|
150
|
+
Raises
|
|
151
|
+
______
|
|
152
|
+
AssertionError
|
|
153
|
+
Raised if any of the tests fail (stdout messages allow the user to easily determine which test case failed).
|
|
154
|
+
|
|
155
|
+
"""
|
|
156
|
+
assert isinstance(unittest_obj, TestCase)
|
|
157
|
+
assert callable(test_func)
|
|
158
|
+
if true_inputs is None:
|
|
159
|
+
true_inputs = []
|
|
160
|
+
else:
|
|
161
|
+
assert type(true_inputs) == list
|
|
162
|
+
if false_inputs is None:
|
|
163
|
+
false_inputs = []
|
|
164
|
+
else:
|
|
165
|
+
assert type(false_inputs) == list
|
|
166
|
+
assert type(false_inputs) == list
|
|
167
|
+
assert type(error_if_false) == bool
|
|
168
|
+
assert issubclass(error_type, Exception)
|
|
169
|
+
assert type(test_desc) == str
|
|
170
|
+
assert type(success_desc) == str
|
|
171
|
+
# print("TESTING " + test_desc.upper())
|
|
172
|
+
assert_func = unittest_obj.assertEqual
|
|
173
|
+
test_inputs = true_inputs.copy()
|
|
174
|
+
test_inputs.extend(false_inputs)
|
|
175
|
+
expected_outputs = [(True)] * len(true_inputs)
|
|
176
|
+
false_output = False
|
|
177
|
+
if error_if_false:
|
|
178
|
+
false_output = error_type
|
|
179
|
+
expected_outputs.extend([(false_output)] * len(false_inputs))
|
|
180
|
+
num_tests = len(test_inputs)
|
|
181
|
+
assert num_tests == len(expected_outputs)
|
|
182
|
+
if num_tests > 0:
|
|
183
|
+
io_pairs = [()]*num_tests
|
|
184
|
+
io_index = 0
|
|
185
|
+
while io_index < num_tests:
|
|
186
|
+
test_input = test_inputs[io_index]
|
|
187
|
+
expected_output = expected_outputs[io_index]
|
|
188
|
+
io_pairs[io_index] = (test_input, expected_output)
|
|
189
|
+
io_index += 1
|
|
190
|
+
run_func_tests(unittest_obj, assert_func, test_func, io_pairs, test_desc)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
# test_num = 1
|
|
194
|
+
# num_tests = len(true_inputs) + len(false_inputs)
|
|
195
|
+
# for true_input in true_inputs:
|
|
196
|
+
# assert type(true_input) == tuple
|
|
197
|
+
# print(f"Test #{test_num} of {num_tests}")
|
|
198
|
+
# run_single_test(unittest_obj, assert_func, test_func, true_input, (True), f"{test_func.__name__} function for input "
|
|
199
|
+
# + str(true_input), success_desc)
|
|
200
|
+
# test_num += 1
|
|
201
|
+
# for false_input in false_inputs:
|
|
202
|
+
# assert type(false_input) == tuple
|
|
203
|
+
# print(f"Test #{test_num} of {num_tests}")
|
|
204
|
+
# if error_if_false:
|
|
205
|
+
# assert_func = unittest_obj.assertRaises
|
|
206
|
+
# run_single_test(unittest_obj, assert_func, test_func, false_input, TypeError,
|
|
207
|
+
# f"{test_func.__name__} function for input "
|
|
208
|
+
# + str(false_input), success_desc)
|
|
209
|
+
# test_num += 1
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: test_helper_by_delica
|
|
3
|
+
Version: 0.1.dev1
|
|
4
|
+
Summary: A Python package that simplifies the creation and execution of unittest test cases.
|
|
5
|
+
Author: Delica Leboe-McGowan
|
|
6
|
+
Author-email: Delica Leboe-McGowan <stormindustries22@outlook.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Dynamic: author
|
|
13
|
+
|
|
14
|
+
# Test-helper-by-delica
|
|
15
|
+
|
|
16
|
+
## Purpose
|
|
17
|
+
|
|
18
|
+
This Python package simplifies the creation and execution of unittest (a widely used library for unit testing) test
|
|
19
|
+
cases, in order to help programmers efficiently develop and run tests for their Python software.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
## Getting Started
|
|
24
|
+
|
|
25
|
+
## Citation
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
requirements.txt
|
|
5
|
+
setup.py
|
|
6
|
+
.github/workflows/main.yml
|
|
7
|
+
test_helper_by_delica/__init__.py
|
|
8
|
+
test_helper_by_delica/test_helper_funcs.py
|
|
9
|
+
test_helper_by_delica.egg-info/PKG-INFO
|
|
10
|
+
test_helper_by_delica.egg-info/SOURCES.txt
|
|
11
|
+
test_helper_by_delica.egg-info/dependency_links.txt
|
|
12
|
+
test_helper_by_delica.egg-info/top_level.txt
|
|
13
|
+
tests/test_test_helper_funcs.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
test_helper_by_delica
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from unittest import TestCase
|
|
2
|
+
import test_helper_by_delica.test_helper_funcs as test_lib
|
|
3
|
+
|
|
4
|
+
def test_func_always_true(test_int1=0, test_int2=0, test_bool1=True, test_bool2=False, test_str1="", test_str2=""):
|
|
5
|
+
return True
|
|
6
|
+
|
|
7
|
+
def test_func_always_false(test_int1=0, test_int2=0, test_bool1=True, test_bool2=False, test_str1="", test_str2=""):
|
|
8
|
+
return False
|
|
9
|
+
|
|
10
|
+
def test_func_is_int(test_input=0):
|
|
11
|
+
return type(test_input) is int
|
|
12
|
+
|
|
13
|
+
def test_func_is_int_type_error_if_false(test_input=0):
|
|
14
|
+
is_int = type(test_input) is int
|
|
15
|
+
if not is_int:
|
|
16
|
+
raise TypeError(f"{test_input} is not an integer")
|
|
17
|
+
return is_int
|
|
18
|
+
|
|
19
|
+
class Test(TestCase):
|
|
20
|
+
def test_test_bool_func(self):
|
|
21
|
+
# test_lib.test_bool_func(self, test_func_always_true, true_inputs=[(),(1,),(1,2),(1,2,True,False),
|
|
22
|
+
# (1,2,True,False,"A","ab")],
|
|
23
|
+
# test_desc="always true function")
|
|
24
|
+
# test_lib.test_bool_func(self, test_func_always_false, false_inputs=[(),(1,),(1,2),(1,2,True,False),
|
|
25
|
+
# (1,2,True,False,"A","ab")],
|
|
26
|
+
# test_desc="always false function")
|
|
27
|
+
# test_lib.test_bool_func(self, test_func_is_int, true_inputs=[(),(1,),(-1,),(10000,),(-10000,)],
|
|
28
|
+
# false_inputs=[(1.0,),(-1.0,),(10000.0,),(-10000.0,),("",),("int",),(True,),(False,)],
|
|
29
|
+
# test_desc="is int function")
|
|
30
|
+
test_lib.test_bool_func(self, test_func_is_int_type_error_if_false, true_inputs=[(), (1,), (-1,), (10000,), (-10000,)],
|
|
31
|
+
false_inputs=[(1.0,), (-1.0,), (10000.0,), (-10000.0,), ("",), ("int",), (True,),
|
|
32
|
+
(False,)],
|
|
33
|
+
test_desc="is int function with TypeError if false", error_if_false=True, error_type=TypeError)
|
|
34
|
+
test = 0
|