Skip to main content

WishBone

What?

A small and simple framework to measure and compare the execution speed of different methods in a class.

Example

#!/usr/bin/python

from testlap import TestLap
from random import randint

class Conditional_vs_Exception():
    '''
    Compare if then against try: except.
    '''

    def __init__(self):
        pass

    def test_1_if_then_else(self):
        '''Evaluate a value using if then else.'''

        number = randint(0,1)
        if number == 1:
            pass
        else:
            pass

    def test_2_try_except(self):
        '''Evaluate a value using try: except.'''

        number = randint(0,1)
        try:
            number == 1
        except:
            pass
        else:
            pass

if __name__ == '__main__':

    test_lap=TestLap(instance=Conditional_vs_Exception(), iterations=10000000)
    test_lap.go()
Running test_1_if_then_else
OK
Running test_2_try_except
OK
3.6.0 (default, Feb 12 2017, 22:33:51)
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]
Linux-4.9.10-100.fc24.x86_64-x86_64-with-fedora-24-Twenty_Four

    Compare if then against try: except.

+---------------------+--------------------------------------+--------+---------+--------------+
| Function            | Description                          | Result | Seconds | Iterations/s |
+---------------------+--------------------------------------+--------+---------+--------------+
| test_1_if_then_else | Evaluate a value using if then else. | OK     |  13.586 |   736049.706 |
| test_2_try_except   | Evaluate a value using try: except.  | OK     |  13.898 |   719536.763 |
+---------------------+--------------------------------------+--------+---------+--------------+

Metadata

Release files for testlap 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for testlap 1.0.0
File Size Uploaded Provenance Actions
testlap-1.0.0.tar.gz 3.1 kB Without provenance Details for testlap-1.0.0.tar.gz

Release files / testlap-1.0.0.tar.gz

Download URL testlap-1.0.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
de17a5d32d02811e1ae11aaffcd381fa5a3d5bfa4415b716b4bd7c3b143b37a1
BLAKE2b-256 checksum
How to use checksums
275da056fb48d1fe58c4172400f04c958efde7b562b014ae1f68de00eff94288
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for testlap 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page