'L{dns._OPTVariableOption.encode} encodes the code and data
instance attributes to a byte string which also includes the
data length.'

def test_encode(self):

    o = dns._OPTVariableOption(1, 'foobar')
    b = BytesIO()
    o.encode(b)
    self.assertEqual(b.getvalue(), '\x00\x01\x00\x06foobar')
