Skip to content

Commit c8d757e

Browse files
committed
updated docs
- Wrote 5 new tests - add site url in docs - minor changes
1 parent abde086 commit c8d757e

File tree

9 files changed

+135
-15
lines changed

9 files changed

+135
-15
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CodeRunner 🏃
22

3-
> [Judge0 API](https://api.judge0.com/) Interface written in Python
3+
> A judge 👨🏽‍⚖️ for your programs, run and test your programs through Python
44
55

66
![PyPI](https://img.shields.io/pypi/v/coderunner?color=blue)
@@ -25,6 +25,7 @@ or directly from GitHub if you cannot wait to test new features
2525
```bash
2626
pip install git+https://github.com/codeclassroom/CodeRunner.git
2727
```
28+
2829
## Usage
2930

3031
```python
@@ -79,9 +80,9 @@ flake8 coderunner --max-line-length=88 --ignore=F401
7980
pylint coderunner --disable=bad-continuation,invalid-name,too-many-instance-attributes
8081
```
8182

82-
## Changelog
83+
## 📝 Changelog
8384

84-
Changelog can be found in [CHANGELOG.md](CHANGELOG.md)
85+
See the [CHANGELOG.md](CHANGELOG.md) file for details.
8586

8687

8788
## Author
@@ -93,7 +94,7 @@ Changelog can be found in [CHANGELOG.md](CHANGELOG.md)
9394

9495
[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com)
9596

96-
## 📝 License
97+
## 📜 License
9798

9899
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
99100

coderunner/coderunner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ def getStatus(self):
174174
"""
175175
Return submission status
176176
"""
177-
178177
status = self.__readStatus(self.__token)
179178

180179
return status

docs/changelog.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,53 @@
11
# Changelog
22

3-
See changelog on [GitHub](https://github.com/codeclassroom/CodeRunner/blob/master/CHANGELOG.md)
43

5-
## Releases
4+
5+
## [0.5] - Dec x, 2019
6+
7+
### Added
8+
9+
- New instance method - `run()`.
10+
- `run()` is now used to run the code i.e the code is submitted to Judge0 api using this method.
11+
- Support for *Bash 4.4*.
12+
13+
### Changed
14+
- Renamed Class `Run` to `code` for easier usage.
15+
- `getStatus()`, it now only returns the status in comparison to older versions where it performed multiple functions (submitting code on judge0 api).
16+
17+
### Removed
18+
- `requests` as a dependency, Network requests are now 50% faster.
19+
20+
21+
## [0.4] - Nov 11, 2019
22+
23+
### Added
24+
25+
- `getSubmissionDate()`, `getExitCode` new methods.
26+
- Official Documentation.
27+
28+
### Changed
29+
30+
- Class Run `init` - Now you can pass _source code_, _input_ and _output_ to program as strings (limited to file paths in prior versions).
31+
32+
33+
## [0.3] - Nov 9, 2019
34+
35+
### Added
36+
37+
- Removed redundant imports
38+
- Added Module/Class docstrings for documentation
39+
- Formatted Code
40+
41+
42+
## [0.2] - Oct 31, 2019
43+
44+
### Changed
45+
46+
- Fix import requests problem.
47+
48+
49+
## [0.1] - Oct 30, 2019
50+
- Initial Release
51+
52+
# Releases
653
See releases on [PyPi](https://pypi.org/project/coderunner/#history)

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CodeRunner 🏃
22

3-
> [Judge0 API](https://api.judge0.com/) Interface written in Python
3+
> A judge 👨🏽‍⚖️ for your programs, run and test your programs through Python
44
55
[![Build Status](https://travis-ci.org/codeclassroom/CodeRunner.svg?branch=master)](https://travis-ci.org/codeclassroom/CodeRunner)
66
![PyPI](https://img.shields.io/pypi/v/coderunner?color=blue)

docs/installation.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ Installing coderunner is pretty simple, just run
44

55
`pip install coderunner`
66

7-
or to install a specific verison
7+
Install a specific verison
88

9-
`pip install coderunner==0.3`
9+
`pip install coderunner==0.4`
10+
11+
or directly from GitHub if you cannot wait to test new features
12+
13+
`pip install git+https://github.com/codeclassroom/CodeRunner.git`
1014

1115
If you have already installed it and want to update
1216

docs/judge0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# [judge0](https://judge0.com/)
22

3-
CodeRunner is powered by judge0 api.<br>
3+
CodeRunner is powered by Judge0 api.<br>
44

55
### [API Docs](https://api.judge0.com/)
66
### [GItHub Repository](https://github.com/judge0/api)

docs/api-usage.md renamed to docs/usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# API Usage
1+
# Usage
22

33
coderunner provides the following class constructors
44

mkdocs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
site_name: CodeRunner
2-
site_url: https://coderunner.readthedocs.io/en/latest/
2+
site_url: https://codeclassroom.github.io/CodeRunner/
33
repo_url: https://github.com/codeclassroom/CodeRunner
44
site_author: Bhupesh Varshney
5-
site_description: CodeRunner v0.3 Documentation
5+
site_description: CodeRunner v0.5 Documentation
66
copyright: © 2019, Bhupesh Varshney
77
nav:
88
- Documentation: index.md
99
- Installation: installation.md
10-
- API Usage: api-usage.md
10+
- Usage: usage.md
1111
- Judge0: judge0.md
1212
- Changelog: changelog.md
1313
- About: about.md

tests.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,74 @@ def test_run(self):
121121
"Accepted", "Something Wrong")
122122

123123

124+
# test to check ValueError exception
125+
126+
127+
class TestRunI(unittest.TestCase):
128+
129+
def test_run(self):
130+
with self.assertRaises(ValueError): coderunner.code(
131+
"Hello World",
132+
"PHP",
133+
"Hello World",
134+
path = False
135+
)
136+
137+
138+
# test to check OSError exception
139+
140+
141+
class TestRunJ(unittest.TestCase):
142+
143+
def test_run(self):
144+
with self.assertRaises(OSError): coderunner.code(
145+
"Hello World",
146+
"C++",
147+
"Hello World"
148+
)
149+
150+
151+
# test to check OSError exception
152+
153+
154+
class TestRunK(unittest.TestCase):
155+
156+
def test_run(self):
157+
with self.assertRaises(OSError): coderunner.code(
158+
"testfiles/" + "test_c++.cpp",
159+
"C++",
160+
"Hello World"
161+
)
162+
163+
164+
# test to check OSError exception
165+
166+
167+
class TestRunL(unittest.TestCase):
168+
169+
def test_run(self):
170+
with self.assertRaises(OSError): coderunner.code(
171+
"testfiles/" + "test_c++.cpp",
172+
"C++",
173+
"testfiles/output/" + "output4.txt",
174+
"my_input"
175+
)
176+
177+
178+
# test to check Wrong Answer Status
179+
180+
181+
class TestRunM(unittest.TestCase):
182+
183+
def test_run(self):
184+
source_code = "print(\"This will return Wrong Answer\")"
185+
language = "Python"
186+
output = "Wrong Answer"
187+
r = coderunner.code(source_code, language, output, path=False)
188+
r.run()
189+
self.assertEqual(r.getStatus(),
190+
"Wrong Answer", "Something Wrong")
191+
192+
124193
if __name__ == '__main__':
125194
unittest.main()

0 commit comments

Comments
 (0)