Skip to main content

Creates assertion administor (access) on relatively small prodjects, in order to save time used in raising and writing exceptions. It generate automatically a one-pattern exception.

Project description

quickassert

A Python runtime service: Assertion admin with generated exception

Short Description from v.1.0 (first)

Creates assertion administor (access) on relatively small prodjects, in order to save time used in raising and writing exceptions. It generate automatically a one-pattern exception.

Quick Use

First, run the command:

pip install quickassert

When the installation is done, an example is:

from quickassert import *

entry_assert = new_assert(_global=False)  # necessary to call once if AUTO_NEW_ASSERT is False

# declare assertion test named digit
entry_assert['digit'] = lambda x: 0 <= x < 10


def enter_digit(d: int) -> None:
    if isinstance(d, int):
        entry_assert.digit('d', d)
        print('O.K.')
        return
    raise TypeError('d must be int')

where one can obtain:

>>> enter_digit(4)
>>> O.K.

>>> enter_digit(23)
>>> ValueError: d must be digit

Coming in following versions

  • Better exception and message handling.
  • Mode with inspection, no need to pass variable name if same (maybe with a decorator)
  • Smallest tree checking, for optimisation, for example: (x > 3) & (x > 5) ~ (x > 5)
  • Typing check adapted.
  • And maybe more

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quickassert-0.0.1.tar.gz (10.4 MB view details)

Uploaded Source

Built Distribution

quickassert-0.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file quickassert-0.0.1.tar.gz.

File metadata

  • Download URL: quickassert-0.0.1.tar.gz
  • Upload date:
  • Size: 10.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for quickassert-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0f9f74ae1ffccd0fb88d5096d4c6b99d7a947bf62cf9c9795dacc1dbb60f3119
MD5 f56575843644f248738c0dc46b05739a
BLAKE2b-256 ac86475444fa0899961f52668b0f7318408cb87b9d8db1f8a9d779eb9264072c

See more details on using hashes here.

File details

Details for the file quickassert-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: quickassert-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for quickassert-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f6e2c81e544025e4292b1fc39433b287ea58316d7fa1a16dca45be8b6c75cad
MD5 1a89ae9367f313d2a7abb94d428771e4
BLAKE2b-256 28d901434f0be53e9a56ea6e09439fd2e5a4bfc8e8f3277fc5a8d537f1692342

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page