From baa71e410454682415405ad0e275f946426d740f Mon Sep 17 00:00:00 2001 From: "minecraftchest1@outlook.com" Date: Sun, 26 Jan 2025 13:31:10 -0600 Subject: [PATCH] Fix test failures. --- src/dnscode/dnscode.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dnscode/dnscode.py b/src/dnscode/dnscode.py index 68564c6..ed056f7 100644 --- a/src/dnscode/dnscode.py +++ b/src/dnscode/dnscode.py @@ -195,18 +195,18 @@ class SRV(Record): self.data = f"{self.priority} {self.weight} {self.port} {self.target}" -#@dataclass +@dataclass class Zone: """Represents a DNS zone containing multiple records.""" - origin: str - records:list = [] + origin: str = 'example.com' + records: list = field(default_factory=list) - def __init__(self, origin: str): + def __post_init__(self): """Initializes a zone with the given origin and ensures it ends with a dot.""" - if origin[-1] != '.': - self.origin = origin + '.' - else: - self.origin = origin + if self.origin[-1] != '.': + self.origin = self.origin + '.' + + #self.records: list = field(default_factory=list) def __str__(self): """Returns a string representation of the zone."""