From 4cb54a62aaa4e04d01714fbcbc2cb93fbad74233 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 27 Mar 2005 15:05:34 +0000 Subject: remove BOMs from input streams git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3138 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_io.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 test/test_io.py (limited to 'test/test_io.py') diff --git a/test/test_io.py b/test/test_io.py new file mode 100755 index 000000000..906c8474d --- /dev/null +++ b/test/test_io.py @@ -0,0 +1,27 @@ +#! /usr/bin/env python + +# Author: Felix Wiemann +# Contact: Felix_Wiemann@ososo.de +# Revision: $Revision$ +# Date: $Date$ +# Copyright: This module has been placed in the public domain. + +""" +Test module for io.py. +""" + +import unittest +from docutils import io + + +class InputTests(unittest.TestCase): + + def test_bom(self): + input = io.StringInput(source='\xef\xbb\xbf foo \xef\xbb\xbf bar', + encoding='utf8') + # Assert BOMs are gone. + self.assertEquals(input.read(), u' foo bar') + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.1 From 1784cec8dd9c2e28ca964d70349f415e96cba602 Mon Sep 17 00:00:00 2001 From: wiemann Date: Sun, 27 Mar 2005 15:12:39 +0000 Subject: test that BOMs aren't removed when input data is Unicode git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3139 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_io.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/test_io.py') diff --git a/test/test_io.py b/test/test_io.py index 906c8474d..e65b05c6c 100755 --- a/test/test_io.py +++ b/test/test_io.py @@ -21,6 +21,10 @@ class InputTests(unittest.TestCase): encoding='utf8') # Assert BOMs are gone. self.assertEquals(input.read(), u' foo bar') + # With unicode input: + input = io.StringInput(source=u'\ufeff foo \ufeff bar') + # Assert BOMs are still there. + self.assertEquals(input.read(), u'\ufeff foo \ufeff bar') if __name__ == '__main__': -- cgit v1.2.1 From 7e720ee65bc79a0430adb825f3deae4c93424959 Mon Sep 17 00:00:00 2001 From: goodger Date: Sat, 3 Dec 2005 02:13:12 +0000 Subject: corrected order of imports git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4132 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- test/test_io.py | 1 + 1 file changed, 1 insertion(+) (limited to 'test/test_io.py') diff --git a/test/test_io.py b/test/test_io.py index e65b05c6c..b82911e44 100755 --- a/test/test_io.py +++ b/test/test_io.py @@ -11,6 +11,7 @@ Test module for io.py. """ import unittest +import DocutilsTestSupport # must be imported before docutils from docutils import io -- cgit v1.2.1