Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60011162
test_platex.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Apr 26, 19:20
Size
2 KB
Mime Type
text/x-python
Expires
Sun, Apr 28, 19:20 (2 d)
Engine
blob
Format
Raw Data
Handle
17279412
Attached To
R3683 Slides
test_platex.py
View Options
#!/bin/env python3
# -*- coding: utf-8 -*-
from
__future__
import
print_function
import
unittest
try
:
from
PythonLatex.latex_structure
import
LatexStructure
except
:
pass
class
pLatexTest
(
unittest
.
TestCase
):
"Unit tests for pLatex"
def
setUp
(
self
,
):
pass
def
test_latex_parser_beamer
(
self
):
latex_code
=
r"""
\documentclass[9pt,xcolor=dvipsnames]{beamer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyvrb}
\begin{python}{header}
from Slides.snippet_helper import Snippet, SnippetCollection
Snippet.default_output='latex'
# Snippet.default_line_numbering=True
\end{python}
\py{Snippet.getLatexStyleDefs()}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input{class.tex}
\title{Chapter 4. Pointers}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Pointers and the Computer's Memory}
\only<1>{
\py{yop}
}
\only<2>{
}
$p_x$
ROW\_MAJOR
\end{frame}
\end{document}
"""
tex_struct
=
LatexStructure
()
tex_struct
.
parseLatex
(
latex_code
)
output
=
str
(
tex_struct
)
self
.
assertEqual
(
latex_code
,
output
)
def
test_latex_parser_nested_begin_end
(
self
):
latex_code
=
r'''
\begin{toto}tatie
\begin{re}tututoto \end{re} aa\end{toto}
'''
tex_struct
=
LatexStructure
()
tex_struct
.
parseLatex
(
latex_code
)
output
=
str
(
tex_struct
)
self
.
assertEqual
(
latex_code
,
output
)
def
test_latex_parser_begin_end
(
self
):
latex_code
=
r'\begin{toto}tatie\end{toto}'
tex_struct
=
LatexStructure
()
tex_struct
.
parseLatex
(
latex_code
)
output
=
str
(
tex_struct
)
self
.
assertEqual
(
latex_code
,
output
)
def
test_latex_parser_text
(
self
):
latex_code
=
r'tatie'
tex_struct
=
LatexStructure
()
tex_struct
.
parseLatex
(
latex_code
)
output
=
str
(
tex_struct
)
self
.
assertEqual
(
latex_code
,
output
)
def
test_latex_parser_command
(
self
):
latex_code
=
r'\documentclass[10pt]{article}'
tex_struct
=
LatexStructure
()
tex_struct
.
parseLatex
(
latex_code
)
output
=
str
(
tex_struct
)
self
.
assertEqual
(
latex_code
,
output
)
def
test_latex_parser_nested_begin_command
(
self
):
latex_code
=
r'''{ yala {toto} \begin{align} tutu
\begin{equation} toto \end{equation}
\end{align} {\titi{ tutu} } }'''
tex_struct
=
LatexStructure
()
tex_struct
.
parseLatex
(
latex_code
)
output
=
str
(
tex_struct
)
self
.
assertEqual
(
latex_code
,
output
)
Event Timeline
Log In to Comment