Run update-copyright.py.
[hooke.git] / test / unicode_output.py
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2010-2012 W. Trevor King <wking@drexel.edu>
4 #
5 # This file is part of Hooke.
6 #
7 # Hooke is free software: you can redistribute it and/or modify it under the
8 # terms of the GNU Lesser General Public License as published by the Free
9 # Software Foundation, either version 3 of the License, or (at your option) any
10 # later version.
11 #
12 # Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
15 # details.
16 #
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with Hooke.  If not, see <http://www.gnu.org/licenses/>.
19
20 u"""
21 >>> from hooke.hooke import Hooke, HookeRunner
22 >>> h = Hooke()
23 >>> r = HookeRunner()
24 >>> h = r.run_lines(h, ['help flat_filter_playlist']) # doctest: +REPORT_UDIFF +ELLIPSIS
25 Usage: flat_filter_playlist...
26       F. Musiani, M. Brucale, L. Bubacco, B. Samorì.
27       "Conformational equilibria in monomeric α-Synuclein at the
28 ...
29 """
30
31 import sys
32 reload(sys)
33 sys.setdefaultencoding('utf-8')
34 import hooke.util.encoding
35 hooke.util.encoding.get_encoding = lambda : 'utf-8'
36
37 # Override defaultencoding and get_encoding to work around
38 # doctest/unicode limitations:
39 #   Doctest: test.unicode_output
40 #   ... /usr/lib/python2.6/doctest.py:1475: UnicodeWarning: Unicode
41 #   equal comparison failed to convert both arguments to Unicode -
42 #   interpreting them as being unequal
43 #
44 # see
45 #   http://stackoverflow.com/questions/1733414/how-do-i-include-unicode-strings-in-python-doctests
46 # for details.
47 #
48 # Unfortunately, the override also makes the codecs.getwriter() code
49 # that this test is supposed to check a no-op.  Ah well, guess this
50 # will have to wait for Python 3.