No project description provided
Project description
Introduction
pysource_codegen
is able to generate random python code which can be compiled.
The compiled code should no be executed.
This is still a very early version, but it does its job. It is general useful to test tools like formatters, linters or anything which operates on python code.
Install:
pip install pysource-codegen
Usage:
The tool can be used over the CLI:
pysource-codegen --seed 42
or as a library:
from pysource_codegen import generate
seed = 42
print(generate(seed))
You might find pysource-minimize also useful to reduce the generated code which triggers your bug down to a minimal code snipped, which can be used to fix the issue.
Bugs found in other projects:
- https://github.com/psf/black/issues/3676
- https://github.com/psf/black/issues/3678
- https://github.com/psf/black/issues/3677
Todo:
- refactor the existing code
- use probabilities for the ast-nodes from existing python code (use markov chains)
- support older python versions
- allow to customize the probabilities to generate code to test specific language features
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pysource_codegen-0.3.0.tar.gz
(10.8 kB
view hashes)
Built Distribution
Close
Hashes for pysource_codegen-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 434e77b81f570954958564d552ffedf7a0ce76bed2c3ca9beb260027a3b5f1ee |
|
MD5 | 06ce51671761a212f8e38891aa89f4b6 |
|
BLAKE2b-256 | a620ac0f51f33d19f9160dcb4722fbe7bf32315ec0bb1705031cceefa29f9a40 |