An open API service indexing awesome lists of open source software.

https://github.com/danedens/py_function_test_generator

Creates a file called "tests.py" with a call to all classes and functions found in the project. the list is only meant to serve as a starting place for writing your tests
https://github.com/danedens/py_function_test_generator

Last synced: about 1 year ago
JSON representation

Creates a file called "tests.py" with a call to all classes and functions found in the project. the list is only meant to serve as a starting place for writing your tests

Awesome Lists containing this project

README

          

Project Name
------------

This project is a tool for finding and modifying lines in Python files that contain the strings "def" or "class", and writing the modified lines to a file.
This readme was generated by AI and may be inaccurate, Updates will follow shortly

Requirements
------------

- Python 3.6 or higher
- The `os`, `fnmatch`, and `re` modules

Usage
-----

To use the tool, run the `main.py` script with Python:

python UnitTests.py

This will search for all Python files in the parent folder of the current folder, and find all lines that contain the strings "def" or "class". The tool will then remove any instances of the strings "self" and " -> WebElement" from the lines, and write the modified lines to the file `tests.py`. If the file `tests.py` doesn't exist, it will be created.

The tool will overwrite the contents of the `tests.py` file if it already exists. If you want to append the modified lines to the end of the file instead of overwriting it, you can modify the `write_results` function in the `main.py` script to open the file in append mode instead of write mode.

```python
def write_results(modified_strings):
# Open the file in append mode
with open('tests.py', 'a') as f:
# Iterate through the modified strings
for s in modified_strings:
# Write the string to the file followed by a newline character
f.write(s + '\n')