@@ 84-112 (lines=29) @@ | ||
81 | is_dict[k] = str(val[k]) |
|
82 | self.assertEqual(is_dict, default_should) |
|
83 | ||
84 | def test_parse_makefiles_section(self): |
|
85 | makefiles_should = OrderedDict([ |
|
86 | ('j', 'a\nmultiline\nvalue'), |
|
87 | ('another', 'a\nmultiline\nvalue'), |
|
88 | ('comment1', '# just a omment'), |
|
89 | ('comment2', '# just a omment'), |
|
90 | ('lastone', 'val'), |
|
91 | ('comment3', ''), |
|
92 | ('a_default', 'val'), |
|
93 | ('comment0', '# do you know that thats a comment'), |
|
94 | ('test', 'content'), |
|
95 | ('t', ''), |
|
96 | ('escaped_=equal', 'escaped_#hash'), |
|
97 | ('escaped_\\backslash', 'escaped_ space'), |
|
98 | ('escaped_,comma', 'escaped_.dot')]) |
|
99 | ||
100 | # Pop off the default section. |
|
101 | self.sections.popitem(last=False) |
|
102 | ||
103 | key, val = self.sections.popitem(last=False) |
|
104 | self.assertTrue(isinstance(val, Section)) |
|
105 | self.assertEqual(key, 'makefiles') |
|
106 | ||
107 | is_dict = OrderedDict() |
|
108 | for k in val: |
|
109 | is_dict[k] = str(val[k]) |
|
110 | self.assertEqual(is_dict, makefiles_should) |
|
111 | ||
112 | self.assertEqual(val["comment1"].key, "comment1") |
|
113 | ||
114 | def test_parse_empty_elem_strip_section(self): |
|
115 | empty_elem_strip_should = OrderedDict([ |
|
@@ 114-140 (lines=27) @@ | ||
111 | ||
112 | self.assertEqual(val["comment1"].key, "comment1") |
|
113 | ||
114 | def test_parse_empty_elem_strip_section(self): |
|
115 | empty_elem_strip_should = OrderedDict([ |
|
116 | ('a', 'a, b, c'), |
|
117 | ('b', 'a, ,, d'), |
|
118 | ('c', ',,,'), |
|
119 | ('comment4', ''), |
|
120 | ('a_default', 'val'), |
|
121 | ('another', 'val'), |
|
122 | ('comment0', '# do you know that thats a comment'), |
|
123 | ('test', 'content'), |
|
124 | ('t', ''), |
|
125 | ('escaped_=equal', 'escaped_#hash'), |
|
126 | ('escaped_\\backslash', 'escaped_ space'), |
|
127 | ('escaped_,comma', 'escaped_.dot')]) |
|
128 | ||
129 | # Pop off the default and makefiles section. |
|
130 | self.sections.popitem(last=False) |
|
131 | self.sections.popitem(last=False) |
|
132 | ||
133 | key, val = self.sections.popitem(last=False) |
|
134 | self.assertTrue(isinstance(val, Section)) |
|
135 | self.assertEqual(key, 'empty_elem_strip') |
|
136 | ||
137 | is_dict = OrderedDict() |
|
138 | for k in val: |
|
139 | is_dict[k] = str(val[k]) |
|
140 | self.assertEqual(is_dict, empty_elem_strip_should) |
|
141 | ||
142 | def test_remove_empty_iter_elements(self): |
|
143 | # Test with empty-elem stripping. |