Skip to main content

A simple leetcode testing utility.

Project description

Leetcode Test

Leetcode Test

A package that allows you to test leetcode answers with minimal setup.

PRs Welcome

Installation

pip3 install leetcodetest

Usage

1. Import Leetcodetest:

from leetcodetest import LeetcodeTester

2. Copy the Solution class:

class Solution:
    def arrayIntoInteger(self, arr):
        return sum(arr)

3. Specifcy the input and expected output:

LeetcodeTester.test(Solution, givenInput=[1, 2, 3], expectedOutput=6)

Ready! Work on your problem and run the file to see your results.

Note: LeetcodeTest automatically finds the method to test your solution, to do so it looks for methods that do not start with _. You may have only one method which is usually provided by Leetcode. Prefix other methods using _.

# Forbidden
class Solution:
    def my_method(self):
        print("Not OK")
        self.my_method_two()

    def my_method_two(self):
        print("Not OK")

# Correct usage
class Solution:
    def my_method(self):
        print("OK, I am executed by LeetcodeTest")
        self._my_method_two()

    def _my_method_two(self):
        print("OK")

Contributions

Contributions are welcome at any time.

Maintainers

Name
@Asmeili

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

leetcodetest-0.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

leetcodetest-0.0.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file leetcodetest-0.0.1.tar.gz.

File metadata

  • Download URL: leetcodetest-0.0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for leetcodetest-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0a8cc7284372b70ea43a0a10089da8b5acf4972af13298821d7cf2610e1b08a9
MD5 ba3594ec795e1c4b75c3f31f9956ac51
BLAKE2b-256 c82f3ce834834fd68243847e7aaddf647598c79e263720c72b423bfb89719f58

See more details on using hashes here.

File details

Details for the file leetcodetest-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: leetcodetest-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for leetcodetest-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a106300b460878427c19260385009ef2bbf421000069197bb16158e74197e0f
MD5 5fbbe86305856b50bfa8a44c2acc7f56
BLAKE2b-256 9a8f00d9727a8416759a87e3423f9493b12f4e9d91a14ad0de0e3e43ca4427ea

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