File: CSSStyles.py

package info (click to toggle)
plastex 3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,132 kB
  • sloc: python: 23,341; xml: 18,076; javascript: 7,755; ansic: 46; makefile: 40; sh: 26
file content (35 lines) | stat: -rw-r--r-- 808 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from pytest import fixture

from plasTeX.TeX import TeX

@fixture
def node():
    s = TeX()
    s.input(r'\texttt{hi}')
    return s.parse().childNodes[0]

def test_no_style(node):
    style = node.style.inline
    assert style is None

def test_empty_style(node):
    node.style['width'] = ''
    style = node.style.inline
    assert style is None

def test_one_style(node):
    node.style['width'] = '100%'
    style = node.style.inline
    assert style == 'width:100%'

def test_two_styles(node):
    node.style['width'] = '100%'
    node.style['height'] = '100%'
    style = node.style.inline
    assert style == 'width:100%; height:100%'

def test_empty_style_excluded(node):
    node.style['width'] = ''
    node.style['height'] = '100%'
    style = node.style.inline
    assert style == 'height:100%'