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
functionis not provided, the default function would bemain - The order in which the
inputObjects are supposed to be added would be same as the params passed in thefunction.
Input/Output Structure
? - Optional
{
value: any,
type?: any,
}
Supported Types
intfloatlisttupledictsetboollinkedlistbinarytree
Metadata
Release files for codetest 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| codetest-1.0.1.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| codetest-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.6 kB
Release files / codetest-1.0.1.tar.gz
| Download URL | codetest-1.0.1.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac61d41ef1c0e92108f2d331079cee12fdbb061073aff18a8caae193976ad1e7
|
|
BLAKE2b-256 checksum How to use checksums |
76af228af6f196d4955031c910b724c1f3e937592ee7d8c37512c7b773a4d4b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.1
|
Release files / codetest-1.0.1-py3-none-any.whl
| Download URL | codetest-1.0.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9dcbdd1d4de0a5f5752d40c2c431eaea6f8f1334d65bf0e9af8a8741e5e6d88a
|
|
BLAKE2b-256 checksum How to use checksums |
4add25e29ffda57b71974b3d46e185633d7349795192d3fd7d3d81371f04aaec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.1
|