def test_empty_pi(self): """ Tests the parsing of the data of an empty processing instruction. """ pi_data = " \t \n " data = parse_pi_data(pi_data) self.assertEqual(data, {})
def test_pi_with_non_attribute_data(self): """ Tests the parsing of the data of a complex processing instruction containing non-attribute data. """ pi_data = """ \t keyword att1="value1" """ data = parse_pi_data(pi_data) self.assertEqual(data, {"keyword": None, "att1": "value1"})
def test_simple_pi_with_simple_quotes(self): """ Tests the parsing of the data of a simple processing instruction using simple quotes for embedding the value. """ pi_data = """ \t att='value'\n """ data = parse_pi_data(pi_data) self.assertEqual(data, {"att": "value"})
def test_simple_pi_with_double_quotes(self): """ Tests the parsing of the data of a simple processing instruction using double quotes for embedding the value. """ pi_data = u""" \t att="value"\n """ data = parse_pi_data(pi_data) self.assertEquals(data, {u"att": u"value"})
def test_complex_pi_with_different_quotes(self): """ Tests the parsing of the data of a complex processing instruction using simple quotes or double quotes for embedding the values. """ pi_data = """ \t att='value'\n att2="value2" att3='value3'""" data = parse_pi_data(pi_data) self.assertEqual(data, {"att": "value", "att2": "value2", "att3": "value3"})