1
2
3 from logilab.common.testlib import TestCase, unittest_main
4 from logilab.common.xmlutils import parse_pi_data
5
6
9 """
10 Tests the parsing of the data of an empty processing instruction.
11 """
12 pi_data = u" \t \n "
13 data = parse_pi_data(pi_data)
14 self.assertEquals(data, {})
15
17 """
18 Tests the parsing of the data of a simple processing instruction using
19 double quotes for embedding the value.
20 """
21 pi_data = u""" \t att="value"\n """
22 data = parse_pi_data(pi_data)
23 self.assertEquals(data, {u"att": u"value"})
24
26 """
27 Tests the parsing of the data of a simple processing instruction using
28 simple quotes for embedding the value.
29 """
30 pi_data = u""" \t att='value'\n """
31 data = parse_pi_data(pi_data)
32 self.assertEquals(data, {u"att": u"value"})
33
35 """
36 Tests the parsing of the data of a complex processing instruction using
37 simple quotes or double quotes for embedding the values.
38 """
39 pi_data = u""" \t att='value'\n att2="value2" att3='value3'"""
40 data = parse_pi_data(pi_data)
41 self.assertEquals(data, {u"att": u"value", u"att2": u"value2",
42 u"att3": u"value3"})
43
45 """
46 Tests the parsing of the data of a complex processing instruction
47 containing non-attribute data.
48 """
49 pi_data = u""" \t keyword att1="value1" """
50 data = parse_pi_data(pi_data)
51 self.assertEquals(data, {u"keyword": None, u"att1": u"value1"})
52
53
54
55
56 if __name__ == '__main__':
57 unittest_main()
58