Skip to content

Commit

Permalink
function desc in docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
LarynQi committed Jan 24, 2021
1 parent 6fcd8be commit 5dbff30
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ A Python client for autograding Python, Scheme, and SQL files. Based on the [OK]

## Changelog

### v0.1.8 - 1/23/21
* Allow for ordinary function descriptions alongside `ok-disc` test cases within Python docstrings.

### v0.1.7 - 1/13/21
* Persistent sessions workaround
* Multi-line doctests now supported
Expand Down
2 changes: 1 addition & 1 deletion ok-disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from languages import *

src = ""
version = "0.1.7"
version = "0.1.8"

parser = argparse.ArgumentParser(prog="ok", description="A lightweight autograder to test your work!")
parser.add_argument("func", metavar="function_to_test", nargs="?", default=None, help="function to be tested (optional)")
Expand Down
6 changes: 4 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def _search(src, language):
pass
elif re.match(language.formatting.expect, line) and line != "\n":
tests[question][len(tests[question]) - 1].output += line.strip()[9 + offset:] + "\n"
elif line == "\n" or re.match(language.formatting.no_tests, line):
found = False
elif (line == "\n" and language != Language.PYTHON) or re.match(language.formatting.no_tests, line):
match = re.match(language.formatting.no_tests, line)
if match and match.span()[1] - match.span()[0] > 0:
found = False
elif re.match(language.formatting.test, line):
tests[question] = tests.get(question, []) + [Doctest(language, number, line.strip()[2 + offset:])]
Doctest.max_q = max(Doctest.max_q, len(number.replace(".", "")))
Expand Down

0 comments on commit 5dbff30

Please sign in to comment.