File: test_environment.py

package info (click to toggle)
python-pylatex 1.4.2%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,044 kB
  • sloc: python: 3,810; sh: 209; makefile: 169; xml: 12
file content (18 lines) | stat: -rw-r--r-- 513 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python


"""Test to validate that Environments uphold contract of base classes."""

from pylatex.base_classes import Environment


def test_alltt():
    class AllTT(Environment):
        escape = False
        content_separator = "\n"

    alltt = AllTT()
    alltt.append("This is alltt content\nIn two lines")
    s = alltt.dumps()
    assert s.startswith("\\begin{alltt}\nThis is"), "Unexpected start of environment"
    assert s.endswith("two lines\n\\end{alltt}"), "Unexpected end of environment"