Skip to main content

A LIB-rary of useful Python code

Project description

Alib provides simple testing without boilerplate. For example, if myfile.py contains the line:

7 * 8 == 54  # I'm not sure about this!

then running:

$ python -m alib.test myfile.py

will, because the test fails, report the test line and the nature of the failure:

line 3:  7 * 8 == 54  # I'm not sure about this!
(['Eq'], [ReturnValue(56), ReturnValue(54)])

Exceptions are caught. The input line:

(1 + '2') == 3  # Can we add a string to a number?

produces:

line 4:  (1 + '2') == 3  # Can we add a string to a number?
(['Eq'], [ExceptionInstance(TypeError), ReturnValue(3)]

This test line succeeds (because the left hand side raises the right hand side).:

(1 + '2') ** TypeError  # We can't add a string to a number.

To test all Python files in the folder path/to/mydir run the command:

$ python -m alib.test path/to/mydir

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

alib-0.0.1.tar.gz (6.8 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: alib-0.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for alib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e4fa066d5fdf8a93a0763890b1f3a757a4edf1c9866dfb89763fa760dde4a7dd
MD5 64cd3888445d689997725bd08036e286
BLAKE2b-256 c4fe5e818b00bf54cd7de020ca17bcaf63b4642563b1b886c041033e3af76279

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