'A L{TunnelAddress} instance can be indexed to retrieve either the byte
string C{"TUNTAP"} or the name of the tunnel interface, while
triggering a deprecation warning.'

def test_indexing(self):

    address = TunnelAddress(TunnelFlags.IFF_TAP, 'tap0')
    self.assertEqual('TUNTAP', address[0])
    self.assertEqual('tap0', address[1])
    warnings = self.flushWarnings([self.test_indexing])
    message = 'TunnelAddress.__getitem__    is    deprecated    since    Twisted    14.0.0        Use    attributes    instead.'
    self.assertEqual(DeprecationWarning, warnings[0]['category'])
    self.assertEqual(message, warnings[0]['message'])
    self.assertEqual(DeprecationWarning, warnings[1]['category'])
    self.assertEqual(message, warnings[1]['message'])
    self.assertEqual(2, len(warnings))
