some more info and some difficulty added!
This commit is contained in:
56
readme.md
56
readme.md
@@ -6,23 +6,55 @@ but more lightweight
|
||||
|
||||
if you want to contribute write tests like this:
|
||||
|
||||
### FileStructure:
|
||||
|
||||
In /problems/ create a folder named after the problem.
|
||||
|
||||
In this folder create ```manifest.json, test.py, description.md```
|
||||
|
||||
**Manifest.JSON needs to exsist and _needs_ to look like this:**
|
||||
```json
|
||||
{
|
||||
"title": "Title of the Problem",
|
||||
"description": "Write a very short description here",
|
||||
"description_md": "problems/problempath/description.md",
|
||||
"difficulty": "easy || medium || hard",
|
||||
"test_code": "problems/problempath/test.py"
|
||||
}
|
||||
```
|
||||
I do know it might be a bit tedious but this is required and its the easiest way.
|
||||
|
||||
#### After you've decided on how you would name / write your Test write it like this:
|
||||
|
||||
- It is important to note that you _CAN_ write the Code the User is expected to write firstly. **BUT** after writing the UnitTest and it passing, comment out the written code.
|
||||
|
||||
It is supposed to look something like this (/sortlist/):
|
||||
|
||||
```python
|
||||
"""
|
||||
@TESTSAMPLE.PY / NAME THIS "test.py" in your actual project
|
||||
"""
|
||||
import unittest
|
||||
|
||||
#<!-- The Function the User needs to write -->
|
||||
# This is importantly commented out. The UnitTest tests this if uncommented.
|
||||
# This is only here for reference
|
||||
#
|
||||
# def revstring(x):
|
||||
# return x[::-1]
|
||||
" )) First Point from the List "
|
||||
# def sortlist(lst = [4,3,2,1]) -> list:
|
||||
# return sorted(lst)
|
||||
|
||||
#<!-- This Test, test if the function works -->
|
||||
")) This is a 'easy' Test, if you want you can write more defined ones."
|
||||
class TestSolution(unittest.TestCase):
|
||||
def test_simple(self):
|
||||
# !! This needs to be dynamic ; if the user enters some shit then it is supposed to work too
|
||||
x="";
|
||||
self.assertEqual(revstring(x), x[::-1])
|
||||
def test_sort(self):
|
||||
self.x = []
|
||||
self.assertEqual(sortlist(self.x), sorted(self.x)) # pyright: ignore[reportUndefinedVariable] <- This is only here so that pyright doesnt complain ; NOT NECCESARY!
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
```
|
||||
```
|
||||
#### Writing the description:
|
||||
|
||||
**Please** by _God_ write simple and easy to understand terms. If you write like Einstein noone is going to understand you.
|
||||
|
||||
- Syntax:
|
||||
- Normal Markdown.
|
||||
- Start with "##" instead of "#" ; "##" looks better
|
||||
- Use CrossLinks ( something like [W3](https://www.w3schools.com/), or the [PyDocs](https://docs.python.org/3/))
|
||||
- Good Formatting is always appreciated
|
||||
|
||||
Reference in New Issue
Block a user