aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSix <unknown>2010-04-10 22:54:38 -0400
committerSix <unknown>2010-04-10 22:54:38 -0400
commitf0f3489540586f0dd173b7e21c18d58d0cff306d (patch)
tree138010775f1b115bb386d3815b003abf04f48f04 /test
parentc5003706aca7bf32031e848ef57146362bf7e3de (diff)
downloaddodai-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.cfg4
-rw-r--r--test/test_config/test_sections.py6
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]
66protocol=sqlite 66protocol=sqlite
67filename=/tmp/test 67filename=/tmp/test
68
69
70[extra]
71name = \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
22path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..')) 22path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..'))
23sys.path.append(path) 23sys.path.append(path)
24from dodai.tools.himo import Himo 24from dodai.tools.himo import Himo
25from dodai.tools.himo import String2Himo
25from dodai.config.sections import ConfigSections 26from 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
113if __name__ == '__main__': 117if __name__ == '__main__':