MCPcopy Create free account
hub / github.com/rthalley/dnspython / test_basic

Method test_basic

tests/test_wire.py:11–24  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

9
10class BinaryTestCase(unittest.TestCase):
11 def test_basic(self):
12 wire = bytes.fromhex("0102010203040102")
13 p = dns.wire.Parser(wire)
14 self.assertEqual(p.get_uint16(), 0x0102)
15 with p.restrict_to(5):
16 self.assertEqual(p.get_uint32(), 0x01020304)
17 self.assertEqual(p.get_uint8(), 0x01)
18 self.assertEqual(p.remaining(), 0)
19 with self.assertRaises(dns.exception.FormError):
20 p.get_uint16()
21 self.assertEqual(p.remaining(), 1)
22 self.assertEqual(p.get_uint8(), 0x02)
23 with self.assertRaises(dns.exception.FormError):
24 p.get_uint8()
25
26 def test_name(self):
27 # www.dnspython.org NS IN question

Callers

nothing calls this directly

Calls 5

get_uint16Method · 0.95
restrict_toMethod · 0.95
get_uint32Method · 0.95
get_uint8Method · 0.95
remainingMethod · 0.95

Tested by

no test coverage detected