summaryrefslogtreecommitdiff
path: root/tests/test_html_formatter.py
blob: a23fbfa98cd6d33eea31b01e590b259131851e7b (plain)
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
36
37
# -*- coding: utf-8 -*-
"""
    Pygments HTML formatter tests
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: 2006-2007 by Georg Brandl.
    :license: BSD, see LICENSE for more details.
"""

import os
import unittest
import StringIO
import random

from pygments import lexers, formatters
from pygments.token import _TokenType
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer

class HtmlFormatterTest(unittest.TestCase):

# TODO: write this test.
#    def test_external_css(self):
#        pass

    def test_all_options(self):
        tokensource = list(PythonLexer().get_tokens(file(os.path.join(testdir, testfile)).read()))
        
        for optdict in [dict(nowrap=True),
                        dict(linenos=True),
                        dict(linenos=True, full=True),
                        dict(linenos=True, full=True, noclasses=True)]:
        
            outfile = StringIO.StringIO()
            fmt = HtmlFormatter(**optdict)
            fmt.format(tokensource, outfile)