def __init__(self, address: IPv6Address): # This option remains constant, so create a singleton that can be re-used option = ServerUnicastOption(server_address=address) option.validate() super().__init__(option, always_send=True)
def test_bad_option_length(self): with self.assertRaisesRegex(ValueError, 'must have length 16'): ServerUnicastOption.parse(bytes.fromhex('000c000f')) with self.assertRaisesRegex(ValueError, 'must have length 16'): ServerUnicastOption.parse(bytes.fromhex('000c0011'))
def setUp(self): self.option_bytes = bytes.fromhex( '000c001020010db8000000000000000000000001') self.option_object = ServerUnicastOption(IPv6Address('2001:db8::1')) self.parse_option()