Skip to content

On v16 version: Latexify.@generate_test latexify(rs) fails #1352

@TorkelE

Description

@TorkelE

This is specifically for the current candidate version for the next release: #1322. Still, since there is some involved stuff, and we technically can make the release without sorting this out, I wanted to write up what the problem is.

Currently, latexify seems to work for ReactionSystems, but the tests generated by Latexify.@generate_test latexify(rs) have recently (but not too long ago, they did work in the process but broke like 2 weeks ago and I don't think I touched something relevant). The function do work for MTK systems.

Here is a MWE:

using ModelingToolkitBase
using ModelingToolkitBase: t_nounits as t, D_nounits as D
@parameters p d
@variables X(t)
eqs = [D(X) ~ p - d*X]
@mtkcompile sys = System(eqs, t)

using Latexify, Test
Latexify.@generate_test latexify(sys) # Paste this into the next line.
@test latexify(sys) == replace(
raw"\begin{align}
\frac{\mathrm{d} ~ X\left( t \right)}{\mathrm{d}t} &= p - d ~ X\left( t \right)
\end{align}
", "\r\n"=>"\n") # Test passes.

using Catalyst
rs = @reaction_network begin
    (p,d), 0 <--> X
end
Latexify.@generate_test latexify(rs) # Paste this into the next line.
@test latexify(rs) == replace(
raw"\begin{align*}
\varnothing &\xrightleftharpoons[d]{p} \mathrm{X}
 \end{align*}
", "\r\n"=>"\n") # Error
Test Failed at /home/loman/Desktop/Julia Playground/Environment - Catalyst Test (full)/catalyst_tests_playground.jl:179
  Expression: latexify(rs) == replace(raw"\begin{align*}
\varnothing &\xrightleftharpoons[d]{p} \mathrm{X}
 \end{align*}
", "\r\n" => "\n")
   Evaluated: L"\begin{align*}
\varnothing &\xrightleftharpoons[d]{p} \mathrm{X}  
 \end{align*}
" == "\\begin{align*}\n\\varnothing &\\xrightleftharpoons[d]{p} \\mathrm{X}\n \\end{align*}\n"

ERROR: There was an error during testing

The actual display seems fine:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions