A testing library for coding problems
Project description
codetest
A simple python library which makes it easier to test code after solving a coding problem.
How to Install
pip install codetest
How to Use
How to write a testcase?
#index.py
from codetest import CodeTest
class Problem:
def sumOfTwoNumbers(self, a,b):
return a + b
tests = [{
"function" : "sumOfTwoNumbers",
"params" : {
"input":[
{"value":5},
{"value":4},
],
"output":[{"value":8}]
}
}]
CodeTest(tests,Problem)
- This will result in following output
--------------------------[TEST 0]--------------------------
Expected Output: 8
Actual Output: 9
[Time: 0.001ms]
------------------------------------------------------------
Tests
Testcase Structure
? - Optional
tests = [
{
function?: "" // default "main"
params: {
input:[],
output:[]
}
}
]
- If
function
is not provided, the default function would bemain
- The order in which the
input
Objects are supposed to be added would be same as the params passed in thefunction
.
Input/Output Structure
? - Optional
{
value: any,
type?: any,
}
Supported Types
int
float
list
tuple
dict
set
bool
linkedlist
binarytree
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
codetest-1.0.1.tar.gz
(8.0 kB
view hashes)