~ntt-pf-lab/nova/monkey_patch_notification

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/twisted/python/test/test_htmlizer.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2008 Twisted Matrix Laboratories.
 
2
# See LICENSE for details.
 
3
 
 
4
"""
 
5
Tests for L{twisted.python.htmlizer}.
 
6
"""
 
7
 
 
8
from StringIO import StringIO
 
9
 
 
10
from twisted.trial.unittest import TestCase
 
11
from twisted.python.htmlizer import filter
 
12
 
 
13
 
 
14
class FilterTests(TestCase):
 
15
    """
 
16
    Tests for L{twisted.python.htmlizer.filter}.
 
17
    """
 
18
    def test_empty(self):
 
19
        """
 
20
        If passed an empty input file, L{filter} writes a I{pre} tag containing
 
21
        only an end marker to the output file.
 
22
        """
 
23
        input = StringIO("")
 
24
        output = StringIO()
 
25
        filter(input, output)
 
26
        self.assertEqual(output.getvalue(), '<pre><span class="py-src-endmarker"></span></pre>\n')
 
27
 
 
28
 
 
29
    def test_variable(self):
 
30
        """
 
31
        If passed an input file containing a variable access, L{filter} writes
 
32
        a I{pre} tag containing a I{py-src-variable} span containing the
 
33
        variable.
 
34
        """
 
35
        input = StringIO("foo\n")
 
36
        output = StringIO()
 
37
        filter(input, output)
 
38
        self.assertEqual(
 
39
            output.getvalue(),
 
40
            '<pre><span class="py-src-variable">foo</span><span class="py-src-newline">\n'
 
41
            '</span><span class="py-src-endmarker"></span></pre>\n')