Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Jupyter notebook LaTeX math tests #444

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/models/task_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,12 @@ def test_ipynb_to_pdf

# Test if latex math was rendered properly
reader = PDF::Reader.new(task.final_pdf_path)
assert reader.pages.last.text.include?("weight\n")

# PDF-reader incorrectly parses "weight (kg) / height (m)^2" as "weight (2g) / height (m)", misplacing the ^2
# Detecting "height" and "weight" confirms correct LaTeX rendering
assert reader.pages.last.text.include?("BMI: bmi =")
assert reader.pages.last.text.include?("weight")
assert reader.pages.last.text.include?("height (m)")

# ensure the notice is not included when the notebook doesn't have long lines source code cells
# and no errors
Expand Down
4 changes: 2 additions & 2 deletions test_files/submissions/vectorial_graph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -951,7 +951,7 @@
"source": [
"Formula for calculating\n",
"\n",
"BMI: $\\text{bmi}=\\frac{\\text{weight}}{\\text{height}^2}$"
"BMI: $\\text{bmi}=\\frac{\\text{weig}\\text{ht (kg)}}{\\text{hei} \\text{ght (m)}^2}$"
]
}
],
Expand Down