Skip to main content

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 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

Project details


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codetest-1.0.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file codetest-1.0.1.tar.gz.

File metadata

  • Download URL: codetest-1.0.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for codetest-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ac61d41ef1c0e92108f2d331079cee12fdbb061073aff18a8caae193976ad1e7
MD5 e19a6c53dd68f74e9410a8be339b8188
BLAKE2b-256 76af228af6f196d4955031c910b724c1f3e937592ee7d8c37512c7b773a4d4b6

See more details on using hashes here.

File details

Details for the file codetest-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: codetest-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for codetest-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9dcbdd1d4de0a5f5752d40c2c431eaea6f8f1334d65bf0e9af8a8741e5e6d88a
MD5 2bf46c4a102c9baed4cbe717d8652e5d
BLAKE2b-256 4add25e29ffda57b71974b3d46e185633d7349795192d3fd7d3d81371f04aaec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page