Skip to content

Issue with doctest #25

@jowe19

Description

@jowe19

Hi,

the following code as an issue together with the function testmod of doctest module (a space is missing in (2,5)). I get the issue with a classical IDE, but not with latex/pyluatex.

Thanks, and merry Christmas !

\documentclass[11pt]{article}
 
\usepackage{xcolor}
\usepackage{piton}
\usepackage{pyluatex}
 
\NewDocumentEnvironment { PitonREPL } { !O{ } } % le ! est obligatoire
 {
   \PyLTVerbatimEnv
   \begin{pythonrepl}
 }
 {
   \directlua
     {
       tex.print("\\begin{Piton}")
       tex.print(pyluatex.get_last_output())
       tex.print("\\end{Piton}")
       tex.print("") 
     }
   \end{pythonrepl}
 }
 
\begin{document}
 
\begin{python}
import doctest

def division(a: int, b: int) -> (int, int):
	"""
	>>> division(19, 7)
	(2,5)
	"""
	if (a<0) or (b<=0):
		return None
	q, r = 0, a
	while r >= b:
		q += 1
		r -= b  # bq+r = b(q+1) + (r-b)
	return (q, r)	
\end{python}

\begin{PitonREPL}
doctest.testmod()
\end{PitonREPL}

\end{document}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions