'L{extractField} will extract a field used in the format string.
@param flattenFirst: callable to flatten an event'

def test_extractField(self, flattenFirst=(lambda x: x)):

    class ObjectWithRepr(object, ):
        def __repr__(self):
            return 'repr'
    class Something(object, ):
        def __init__(self):
            self.number = 7
            self.object = ObjectWithRepr()
        def __getstate__(self):
            raise NotImplementedError('Just    in    case.')
    event = dict(log_format='{something.number}    {something.object}', something=Something())
    flattened = flattenFirst(event)
    def extract(field):
        return extractField(field, flattened)
    self.assertEqual(extract('something.number'), 7)
    self.assertEqual(extract('something.number!s'), '7')
    self.assertEqual(extract('something.object!s'), 'repr')
