test-fun-with-ast

The repository contains examples of using the fun-with-ast library.

Install and Run Test Programs(tested on Ubuntu 20.04)

We assume you use python > 3.6

  1. Create an empty directory: e.g., mkdir ~/example_fun_with_ast
  2. Change directory into the new directory: cd ~/example_fun_with_ast
  3. Create and activate a virtual environment:
    1. Create a virtual environment: python3 -m venv environment
    2. Activate the virtual environment: source environment/bin/activate
  4. Download the test-fun-with-ast project: git clone https://github.com/shairubin/test-fun-with-ast
  5. Install the fun-with-ast library: pip install fun-with-ast
  6. Run the example rewrite programs:
    1. cd test-fun-with-ast/source_manipulation_examples/
    2. PYTHONPATH=../ python rewrite_if_examples.py
    3. PYTHONPATH=../ python swap_if_else_examples.py
  7. Run the example source match programs
    1. cd ../preserve_source_examples
    2. PYTHONPATH=../ python source_code_preserve_tests.py
  8. Deactivate the virtual environment: deactivate
  9. Optional: delete the directory: rm -rf ~/example_fun_with_ast

Contributors are Welcomed

  1. See open issues - or open a new one.
  2. Have fun.