ttoolly_utils
About
ttoolly_utils provides some useful tools for testing
Getting started
Installation
pip install ttoolly-utils
Usage Examples
1. Asserts
assert_status_code
from ttoolly_utils.asserts import assert_status_code
assert_status_code(404, 200)
# Output: AssertionError: Status code 404. Expected 200
assert_dict_equal
from ttoolly_utils.asserts import assert_dict_equal
d1 = {'a': 1, 'b': 2, 'c': 3}
d2 = {'b': 3, 'd': 4, 'c': {'c1': 2}}
assert_dict_equal(d1, d2)
# Output:
AssertionError: Not in first dict: ['d']
Not in second dict: ['a']
[b]: 2 != 3
[c]:
[c][c1]: 1 != 2
assert_list_equal
from ttoolly_utils.asserts import assert_list_equal
l1 = [1, 2, 3]
l2 = [1, 4, 3]
assert_list_equal(l1, l2)
# Output: AssertionError: [line 1]: 2 != 4
2. Randomizer
get_randname
from ttoolly_utils.randomizer import get_randname
print(get_randname(8, 'w')) # e.g. 'aBcDeFgH'
print(get_randname(10, 'd')) # e.g. '1234567890'
print(get_randname(5, 'p')) # e.g. ';@$..'
print(get_randname(5, 's')) # e.g. '\x0b\n \n'
print(get_randname()) # e.g. 'oNC<H%|`^\t
get_random_color
from ttoolly_utils.randomizer import get_random_color
print(get_random_color('rgb')) # e.g. 'rgb(123, 45, 67)'
print(get_random_color('hex')) # e.g. '#1a2b3c'
get_random_datetime_value
from ttoolly_utils.randomizer import get_random_datetime_value
print(get_random_datetime_value()) # e.g. '2025-06-15 12:34:56.123456'
get_random_domain_value
from ttoolly_utils.randomizer import get_random_domain_value
print(get_random_domain_value(10)) # e.g. 'tf.vl.PRSh'
get_random_email_value
from ttoolly_utils.randomizer import get_random_email_value
print(get_random_email_value(10)) # e.g. 'ae\\;1@c.xh'
print(get_random_email_value(10, safe=True)) # e.g. '30o@dr.lxr'
3. Utils
continue_on_fail
from ttoolly_utils.utils import continue_on_fail
errors = []
with continue_on_fail(errors, "Test block"):
assert 1 == 2, "Numbers do not match"
print(errors)
# Output: ['Test block\nTraceback (most recent call last): ... AssertionError: Numbers do not match']
convert_size_to_bytes
from ttoolly_utils.utils import convert_size_to_bytes
print(convert_size_to_bytes('2K')) # Output: 2048
print(convert_size_to_bytes('5M')) # Output: 5242880
get_all_subclasses
from ttoolly_utils.utils import get_all_subclasses
class A: pass
class B(A): pass
class C(B): pass
print(list(get_all_subclasses(A))) # Output: [<class '__main__.C'>, <class '__main__.B'>]
Metadata
Release files for ttoolly-utils 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ttoolly_utils-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ttoolly_utils-0.1.1-py3-none-any.whl |
Release files / ttoolly_utils-0.1.1-py3-none-any.whl
| Download URL | ttoolly_utils-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5933160d3de53e7f4066cade1b3269417f4a75b5fff43e055ce2fc326b3bd2f
|
|
BLAKE2b-256 checksum How to use checksums |
e8e7e5329d9ff051f9f1f8f1995271e8a4fbb34e90d55d23b94b702ba340768f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for ttoolly-utils 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.