pysut
所属分类:Python编程
开发工具:Python
文件大小:0KB
下载次数:0
上传日期:2023-12-26 20:25:28
上 传 者:
sh-1993
说明: Python中使用TOML配置和装饰器语法的简单测试用例运行器
(A simple test case runner in Python that uses TOML configurations and decorator syntax)
文件列表:
examples/
pysut/
tests/
.flake8
LICENSE
poetry.lock
poetry.toml
pyproject.toml
# pysut
## About
A simple test case runner in Python that uses TOML configurations and decorator syntax.
## Installation
`pip install pysut`
## Usage
- Function
Python
```python
from pysut import test
@test("
")
def function(arg1: int, arg2: int) -> int:
return arg1 + arg2
```
TOML
```toml
name = ["One and Two", "Two and Three"]
metadata = ["Add to 3", "Add to 5"]
i = [[1, 2], [2, 3]]
o = [3, 5]
```
or
```toml
[[cases]]
name = "One and Two"
i = [1, 2]
o = 3
metadata = "Add to 3"
[[cases]]
name = "Two and Three"
i = [2, 3]
o = 5
metadata = "Add to 5"
```
- Input key can be either of - i, in, input, inputs
- Output key can be either of - o, out, output, outputs
- Class (if you want to test instance methods)
Python
```python
from pysut import test
# Specify the name of the method as the second argument
@test("", "function")
class Solution:
def function(self, arg1: int, arg2: int) -> int:
return arg1 + arg2
```
TOML
```toml
name = ["One and Two", "Two and Three"]
metadata = ["Add to 3", "Add to 5"]
init = [] # Has to be specified, indicates class constructor arguments
i = [[1, 2], [2, 3]]
o = [3, 5]
```
or
```toml
[[cases]]
name = "One and Two"
i = [1, 2]
o = 3
metadata = "Add to 3"
init = [] # Has to be specified, indicates class constructor arguments
[[cases]]
name = "Two and Three"
i = [2, 3]
o = 5
metadata = "Add to 5"
init = []
```
- Input key can be either of - i, in, input, inputs
- Output key can be either of - o, out, output, outputs
近期下载者:
相关文件:
收藏者: