A simple leetcode testing utility.
Project description
Leetcode Test
A package that allows you to test leetcode answers with minimal setup.
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a8cc7284372b70ea43a0a10089da8b5acf4972af13298821d7cf2610e1b08a9
|
|
| MD5 |
ba3594ec795e1c4b75c3f31f9956ac51
|
|
| BLAKE2b-256 |
c82f3ce834834fd68243847e7aaddf647598c79e263720c72b423bfb89719f58
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a106300b460878427c19260385009ef2bbf421000069197bb16158e74197e0f
|
|
| MD5 |
5fbbe86305856b50bfa8a44c2acc7f56
|
|
| BLAKE2b-256 |
9a8f00d9727a8416759a87e3423f9493b12f4e9d91a14ad0de0e3e43ca4427ea
|