1 |
bernhard |
2672 |
# Copyright (c) 2005 by Intevation GmbH |
2 |
|
|
# Authors: |
3 |
|
|
# Bernhard Reiter <[email protected]> |
4 |
|
|
# |
5 |
|
|
# This program is free software under the GPL (>=v2) |
6 |
|
|
# Read the file COPYING coming with Thuban for details. |
7 |
|
|
|
8 |
|
|
""" |
9 |
|
|
Test the functions for Thuban's string representation. |
10 |
|
|
""" |
11 |
|
|
|
12 |
|
|
__version__ = "$Revision$" |
13 |
|
|
# $Source$ |
14 |
|
|
# $Id$ |
15 |
|
|
|
16 |
|
|
import unittest |
17 |
|
|
|
18 |
|
|
import support |
19 |
|
|
support.initthuban() |
20 |
|
|
|
21 |
|
|
import Thuban |
22 |
|
|
|
23 |
|
|
class TestInternalEncoding(unittest.TestCase): |
24 |
|
|
"""Test around the thuban default encoding.""" |
25 |
bernhard |
2673 |
|
26 |
|
|
def setUp(self): |
27 |
|
|
"""Save the old internal encoding, so we can restore it.""" |
28 |
|
|
self.saved_encoding=Thuban.get_internal_encoding() |
29 |
|
|
|
30 |
|
|
def tearDown(self): |
31 |
|
|
"""Restore saved internal encoding.""" |
32 |
|
|
Thuban.set_internal_encoding(self.saved_encoding) |
33 |
|
|
|
34 |
bernhard |
2672 |
def test_notice_bad_internalencoding(self): |
35 |
bernhard |
2673 |
bad_encoding="this-never-is-a-valid-encoding" |
36 |
|
|
self.assertRaises(LookupError, |
37 |
|
|
Thuban.set_internal_encoding,bad_encoding) |
38 |
bernhard |
2672 |
|
39 |
|
|
if __name__ == "__main__": |
40 |
|
|
support.run_tests() |