Skip to main content

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 be main
  • The order in which the input Objects are supposed to be added would be same as the params passed in the function.

Input/Output Structure

? - Optional

    {
        value: any,
        type?: any,
    }

Supported Types

  1. int
  2. float
  3. list
  4. tuple
  5. dict
  6. set
  7. bool
  8. linkedlist
  9. binarytree

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)

Source distribution for codetest 1.0.1
File Size Uploaded
codetest-1.0.1.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codetest 1.0.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

1.1.0

2 release files

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page