Fix typo
[docutils.git] / test / test_command_line.py
blob529afa951cdcaba74e0f631aab979422daafc327
1 #! /usr/bin/env python
2 # .. coding: utf8
3 # $Id$
4 # Author: Günter Milde <milde@users.sourceforge.net>
5 # Copyright: This module has been placed in the public domain.
7 """
8 Test module for the command line.
9 """
11 import unittest
12 import sys
13 import DocutilsTestSupport # must be imported before docutils
14 import docutils.core
16 try:
17 import subprocess # new in 2.4
18 except ImportError:
19 argv_encoding = None
20 try:
21 import locale
22 argv_encoding = locale.getpreferredencoding()
23 except:
24 argv_encoding = None
26 class CommandLineEncodingTests(unittest.TestCase):
28 def test_sys_argv_decoding(self):
29 if argv_encoding is None: # cannot test
30 return
31 sys.argv.append(u'--title=Dornröschen'.encode(argv_encoding))
32 publisher = docutils.core.Publisher()
33 publisher.process_command_line()
34 self.assertEqual(publisher.settings.title, u'Dornröschen')
35 sys.argv.pop()
37 if __name__ == '__main__':
38 unittest.main()