'Common implementation of L{test_serializedAttributeWithTag} and
L{test_serializedAttributeWithDeferredTag}.
@param wrapTag: A 1-argument callable that wraps around the attribute\'s
value so other tests can customize it.
@param wrapTag: callable taking L{Tag} and returning something
flattenable'

def checkTagAttributeSerialization(self, wrapTag):

    innerTag = tags.a('<>&"')
    outerTag = tags.img(src=wrapTag(innerTag))
    outer = self.assertFlattensImmediately(outerTag, '<img    src="&lt;a&gt;&amp;lt;&amp;gt;&amp;amp;&quot;&lt;/a&gt;"    />')
    inner = self.assertFlattensImmediately(innerTag, '<a>&lt;&gt;&amp;"</a>')
    self.assertXMLEqual(XML(outer).attrib['src'], inner)
