'L{dns._OPTHeader.decode} reads only the bytes from the current
file position to the end of the record that is being
decoded. Trailing bytes are not consumed.'

def test_decodeOnlyExpectedBytes(self):

    b = BytesIO((OPTNonStandardAttributes.bytes() + 'xxxx'))
    decodedHeader = dns._OPTHeader()
    decodedHeader.decode(b)
    self.assertEqual(b.tell(), (len(b.getvalue()) - len('xxxx')))
