~ubuntu-branches/ubuntu/hardy/python-docutils/hardy

« back to all changes in this revision

Viewing changes to test/test_io.py

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-07-10 11:45:05 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060710114505-otkhqcslevewxmz5
Tags: 0.4-3
Added build dependency on python-central (closes: #377580).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
 
 
3
# Author: Felix Wiemann
 
4
# Contact: Felix_Wiemann@ososo.de
 
5
# Revision: $Revision: 4132 $
 
6
# Date: $Date: 2005-12-03 03:13:12 +0100 (Sat, 03 Dec 2005) $
 
7
# Copyright: This module has been placed in the public domain.
 
8
 
 
9
"""
 
10
Test module for io.py.
 
11
"""
 
12
 
 
13
import unittest
 
14
import DocutilsTestSupport              # must be imported before docutils
 
15
from docutils import io
 
16
 
 
17
 
 
18
class InputTests(unittest.TestCase):
 
19
 
 
20
    def test_bom(self):
 
21
        input = io.StringInput(source='\xef\xbb\xbf foo \xef\xbb\xbf bar',
 
22
                               encoding='utf8')
 
23
        # Assert BOMs are gone.
 
24
        self.assertEquals(input.read(), u' foo  bar')
 
25
        # With unicode input:
 
26
        input = io.StringInput(source=u'\ufeff foo \ufeff bar')
 
27
        # Assert BOMs are still there.
 
28
        self.assertEquals(input.read(), u'\ufeff foo \ufeff bar')
 
29
 
 
30
 
 
31
if __name__ == '__main__':
 
32
    unittest.main()