コード例 #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)
コード例 #3
0
 def setUp(self):
     self.option_bytes = bytes.fromhex('00070001ff')
     self.option_object = PreferenceOption(preference=255)
     self.parse_option()
コード例 #4
0
    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
ファイル: preference.py プロジェクト: jackjack821/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)