Skip to content

Commit 3c0fdfb

Browse files
committed
main.py: Add runner examples
1 parent 6bed52d commit 3c0fdfb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tex2lambda/main.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,19 @@ def runner(
2626
output_dir: An optional argument for where to output the Lambda Feedback compatible json/zip files.
2727
answer_file: The absolute path to a TeX answer file.
2828
29-
3029
Returns:
3130
A list of questions and how they would be broken down into different Lambda Feedback sections
3231
in a Python-readable format. If `output_dir` is specified, the corresponding json/zip files are
3332
produced.
33+
34+
Examples:
35+
>>> import os
36+
>>> from tex2lambda.main import runner
37+
>>> # Retrieve an example TeX file and run the given filter.
38+
>>> runner(f"{os.path.dirname(tex2lambda.__file__)}/filters/PartsSepSol/example.tex", "PartsSepSol") # doctest: +ELLIPSIS
39+
Module(questions=[Question(title='', parts=[Part(text=..., worked_solution=''), ...], images=[], _main_text='This is a sample question\\n\\n'), ...])
40+
>>> runner(f"{os.path.dirname(tex2lambda.__file__)}/filters/PartsOneSol/example.tex", "PartsOneSol") # doctest: +ELLIPSIS
41+
Module(questions=[Question(title='', parts=[Part(text='This is part (a)\\n\\n', worked_solution=''), ...], images=[], _main_text='Here is some preliminary question information that might be useful.'), ...)
3442
"""
3543
# The list of questions for Lambda Feedback as a Python API.
3644
module = Module()

0 commit comments

Comments
 (0)