'Assert flattening a root element raises a particular exception.'

def assertFlatteningRaises(self, root, exn):

    d = self.assertFailure(self.assertFlattensTo(root, ''), FlattenerError)
    d.addCallback((lambda exc: self.assertIsInstance(exc._exception, exn)))
    return d
