def test_adjust_description(self): self.assertEqual(x._adjust_field("\n"), "") self.assertEqual(x._adjust_field("\n "), "") self.assertEqual(x._adjust_field(u"abc\n def\n "), "abcdef") self.assertEqual(x._adjust_field("abc d\n e f\n"), "abc de f") self.assertEqual(x._adjust_field("a\tb\t\nc"), "abc")
def load_xml_file(path): kv_mapper = lambda i: (x._get_text_from_node(i, 'name'), x._adjust_field(x._get_text_from_node(i, 'value'))) strip_mapper = lambda i: (i[0].strip(), i[1].strip()) props = x.load_xml_document(path).getElementsByTagName('property') return dict(map(strip_mapper, map(kv_mapper, props)))
def test_adjust_description(self): self.assertEqual(x._adjust_field("\n"), "") self.assertEqual(x._adjust_field("\n "), "") self.assertEqual(x._adjust_field(u"abc\n def\n "), "abcdef") self.assertEqual(x._adjust_field("abc d\n e f\n"), "abc de f") self.assertEqual(x._adjust_field("a\tb\t\nc"), "abc")
def load_xml_file(path): kv_mapper = lambda i: (x.get_text_from_node(i, 'name'), x._adjust_field(x.get_text_from_node(i, 'value'))) strip_mapper = lambda i: (i[0].strip(), i[1].strip()) props = x.load_xml_document(path).getElementsByTagName('property') return dict(map(strip_mapper, map(kv_mapper, props)))