예제 #1
0
 def test_bad_option_length(self):
     with self.assertRaisesRegex(ValueError, 'must have length 1'):
         PreferenceOption.parse(bytes.fromhex('00070002ffff'))
예제 #2
0
파일: basic.py 프로젝트: mndfcked/dhcpkit
    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'))
예제 #5
0
    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)