Enhance hosts file serialization and entry formatting for proper tab alignment; update tests to reflect changes.

This commit is contained in:
Philip Henning 2025-07-29 23:31:30 +02:00
parent cead0c1066
commit 5a2e0d2623
4 changed files with 111 additions and 32 deletions

View file

@ -67,7 +67,7 @@ class TestHostEntry:
comment="Loopback"
)
line = entry.to_hosts_line()
assert line == "127.0.0.1 localhost local # Loopback"
assert line == "127.0.0.1\tlocalhost\tlocal\t# Loopback"
def test_to_hosts_line_inactive(self):
"""Test conversion to hosts file line format for inactive entry."""
@ -77,7 +77,7 @@ class TestHostEntry:
is_active=False
)
line = entry.to_hosts_line()
assert line == "# 192.168.1.1 router"
assert line == "# 192.168.1.1\trouter"
def test_from_hosts_line_simple(self):
"""Test parsing simple hosts file line."""