def METHOD_NAME(self):
    with self.assertRaises(XmlWriterError) as cm:
        self.writer.add_attribute("foo", "bar")
    self.assertEqual("Empty pending tag.", str(cm.exception))
    self.writer.start_tag("a")
    self.writer.add_attribute("a", "bar")
    self.writer.add_attribute("b", True)
    self.writer.add_attribute("c", "{")
    self.writer.add_attribute("d", "{a}b")
    self.writer.add_attribute(QNames.XSI_TYPE, str(DataType.STRING))
    expected = {
        (None, "a"): "bar",
        (None, "b"): "true",
        (None, "c"): "{",
        (None, "d"): "{a}b",
        ("http://www.w3.org/2001/XMLSchema-instance", "type"): "xs:string",
    }
    self.assertEqual(expected, self.writer.attrs)