FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore: fresh docstrings, test name string and workflow step names (#1… · python-zeroconf/python-zeroconf@4339329 · GitHub

Repository navigation

Commit 4339329

Browse files
authored
chore: fresh docstrings, test name string and workflow step names (#1853)
1 parent f01845a commit 4339329

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ jobs:
187187
fetch-depth: 0
188188
ref: ${{ github.ref }}
189189

190-
- env:
190+
- name: Switch to the head branch
191+
env:
191192
BRANCH: ${{ github.head_ref || github.ref_name }}
192193
run: git switch -C "$BRANCH"
193194

@@ -221,7 +222,8 @@ jobs:
221222
fetch-depth: 0
222223
ref: ${{ github.ref }}
223224

224-
- env:
225+
- name: Switch to the head branch
226+
env:
225227
BRANCH: ${{ github.ref_name }}
226228
run: git switch -C "$BRANCH"
227229

‎src/zeroconf/_dns.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ def entry_to_string(self, hdr: str, other: bytes | str | None) -> str:
106106

107107

108108
class DNSQuestion(DNSEntry):
109+
"""A question a resolver asks about a name."""
110+
109111
__slots__ = ("_hash",)
110112

111113
def __init__(self, name: str, type_: int, class_: int) -> None:
@@ -232,6 +234,8 @@ def to_string(self, other: bytes | str) -> str:
232234

233235

234236
class DNSAddress(DNSRecord):
237+
"""Record holding an IPv4 or IPv6 address."""
238+
235239
__slots__ = ("_hash", "address", "scope_id")
236240

237241
def __init__(
@@ -338,6 +342,8 @@ def __repr__(self) -> str:
338342

339343

340344
class DNSPointer(DNSRecord):
345+
"""PTR record naming a service instance."""
346+
341347
__slots__ = ("_hash", "alias", "alias_key")
342348

343349
def __init__(
@@ -389,6 +395,8 @@ def __repr__(self) -> str:
389395

390396

391397
class DNSText(DNSRecord):
398+
"""TXT record carrying the service properties."""
399+
392400
__slots__ = ("_hash", "text")
393401

394402
def __init__(
@@ -431,6 +439,8 @@ def __repr__(self) -> str:
431439

432440

433441
class DNSService(DNSRecord):
442+
"""SRV record with the target host, port, priority and weight."""
443+
434444
__slots__ = ("_hash", "port", "priority", "server", "server_key", "weight")
435445

436446
def __init__(

‎tests/test_init.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ def teardown_module():
2929

3030

3131
class Names(unittest.TestCase):
32+
def test_long_name(self):
33+
generated = r.DNSOutgoing(const._FLAGS_QR_RESPONSE)
34+
question = r.DNSQuestion(
35+
"an.excessively.deep.chain.of.dns.labels.used.for.testing.local.",
36+
const._TYPE_SRV,
37+
const._CLASS_IN,
38+
)
39+
generated.add_question(question)
40+
r.DNSIncoming(generated.packets()[0])
41+
3242
def test_exceedingly_long_name(self):
3343
generated = r.DNSOutgoing(const._FLAGS_QR_RESPONSE)
3444
name = f"{'part.' * 1000}local."

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL