def test_bad_option_length(self): with self.assertRaisesRegex(ValueError, 'must have length 1'): PreferenceOption.parse(bytes.fromhex('00070002ffff'))
def __init__(self, preference: int): # This option remains constant, so create a singleton that can be re-used option = PreferenceOption(preference=preference) option.validate() super().__init__(option, always_send=True)
def setUp(self): self.option_bytes = bytes.fromhex('00070001ff') self.option_object = PreferenceOption(preference=255) self.parse_option()
def test_bad_option_length(self): with self.assertRaisesRegex(ValueError, 'must have length 1'): PreferenceOption.parse(bytes.fromhex('00070000ffff')) with self.assertRaisesRegex(ValueError, 'must have length 1'): PreferenceOption.parse(bytes.fromhex('00070002ffff'))
def __init__(self, preference: int): # This option remains constant, so create a singleton that can be re-used option = PreferenceOption(preference=preference) option.validate() super().__init__(option, always_send=True)