Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/werdl/pyt
Python testing made easier
https://github.com/werdl/pyt
Last synced: about 7 hours ago
JSON representation
Python testing made easier
- Host: GitHub
- URL: https://github.com/werdl/pyt
- Owner: werdl
- License: apache-2.0
- Created: 2023-09-22T14:50:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-23T17:14:06.000Z (about 1 year ago)
- Last Synced: 2023-09-23T20:17:04.497Z (about 1 year ago)
- Language: Python
- Size: 62.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Pyt
### What is pyt?
- a very easy python testing framework
- very minimal. find a bug? you can probably fix it!
- designed to be, pretty much, import and go!
- makes writing tests easier - and you re more likely to write them!
### Installation
- `git clone` this repo
- `cd src`
- `pip install .` in the directory
- and you're away!
- now it just works with import pyt.
### A quick example
- Also in test.py!
- Say we must test this function:
```py
def add(a: int|float, b: int|float) -> int|float:
return a+b
```
- and we wanted to test these conditions:
```py
0+0==0
1+34==35
2+9==10
```
- we could add them with these statements
```py
import pyt
o=pyt.pyt(add) # create instance of pyt on function add
o.addvalues([0,0],0) # list of parameters, expected return value
o.addvalues([1,34],35)
o.addvalues([2,9],10)
o.run() # run the tests, and produce a nice human readable output
"""
Don't want pretty summing-up?
Just run o.run(human_readable=False)!
"""
```![output of test.py](img/test.py.output.png)
### Anything else?
- Pyt has an `__eq__` method, an `__str__` and `__repr__`