diff options
author | Six <unknown> | 2010-04-10 22:54:38 -0400 |
---|---|---|
committer | Six <unknown> | 2010-04-10 22:54:38 -0400 |
commit | f0f3489540586f0dd173b7e21c18d58d0cff306d (patch) | |
tree | 138010775f1b115bb386d3815b003abf04f48f04 /test | |
parent | c5003706aca7bf32031e848ef57146362bf7e3de (diff) | |
download | dodai-macsupport-f0f3489540586f0dd173b7e21c18d58d0cff306d.tar.bz2 dodai-macsupport-f0f3489540586f0dd173b7e21c18d58d0cff306d.tar.xz dodai-macsupport-f0f3489540586f0dd173b7e21c18d58d0cff306d.zip |
added the ability to set the encoding string to the sections object
Diffstat (limited to 'test')
-rw-r--r-- | test/test_config/config.cfg | 4 | ||||
-rw-r--r-- | test/test_config/test_sections.py | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/test/test_config/config.cfg b/test/test_config/config.cfg index 14764ae..3480016 100644 --- a/test/test_config/config.cfg +++ b/test/test_config/config.cfg | |||
@@ -65,3 +65,7 @@ database=testing | |||
65 | [test_db_six] | 65 | [test_db_six] |
66 | protocol=sqlite | 66 | protocol=sqlite |
67 | filename=/tmp/test | 67 | filename=/tmp/test |
68 | |||
69 | |||
70 | [extra] | ||
71 | name = \u8c61 | ||
diff --git a/test/test_config/test_sections.py b/test/test_config/test_sections.py index 2aba3c7..39b41a7 100644 --- a/test/test_config/test_sections.py +++ b/test/test_config/test_sections.py | |||
@@ -22,6 +22,7 @@ import unittest | |||
22 | path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..')) | 22 | path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..')) |
23 | sys.path.append(path) | 23 | sys.path.append(path) |
24 | from dodai.tools.himo import Himo | 24 | from dodai.tools.himo import Himo |
25 | from dodai.tools.himo import String2Himo | ||
25 | from dodai.config.sections import ConfigSections | 26 | from dodai.config.sections import ConfigSections |
26 | 27 | ||
27 | 28 | ||
@@ -32,7 +33,7 @@ class TestSections(unittest.TestCase): | |||
32 | filepath = os.path.join(path, 'config.cfg') | 33 | filepath = os.path.join(path, 'config.cfg') |
33 | self.parser = ConfigParser.ConfigParser() | 34 | self.parser = ConfigParser.ConfigParser() |
34 | self.parser.readfp(open(filepath)) | 35 | self.parser.readfp(open(filepath)) |
35 | self.sections = ConfigSections(Himo) | 36 | self.sections = ConfigSections(String2Himo()) |
36 | 37 | ||
37 | def test_call(self): | 38 | def test_call(self): |
38 | self.sections(self.parser) | 39 | self.sections(self.parser) |
@@ -108,6 +109,9 @@ class TestSections(unittest.TestCase): | |||
108 | val = self.sections.test_db['foo'] | 109 | val = self.sections.test_db['foo'] |
109 | self.assertTrue(val == 'bar') | 110 | self.assertTrue(val == 'bar') |
110 | 111 | ||
112 | def test_section_object_seven(self): | ||
113 | self.sections(self.parser, 'unicode_escape') | ||
114 | self.assertEqual(self.sections.extra.name, u'\u8c61') | ||
111 | 115 | ||
112 | 116 | ||
113 | if __name__ == '__main__': | 117 | if __name__ == '__main__': |