def print_list_diff(list_a: HostList, list_b: HostList) -> None: full_set = list_a.set.union(list_b.set) full_set_sorted = hosts_tools.sort_domains(list(full_set)) print('Lists Diff:') print('{:<50}{:<50}'.format(list_a.filename, list_b.filename)) for domain in full_set_sorted: list_a_value = domain if domain in list_a.set else '' list_b_value = domain if domain in list_b.set else '' if list_a_value != list_b_value: print('{:<50}{:<50}'.format(list_a_value, list_b_value))
def test_sort_sub_domains(self): domains = ["b.y.a", "a.y.a", "y.a", "c.z", "b.a.z", "a.z"] sorted = hosts_tools.sort_domains(domains) assert sorted == ["y.a", "a.y.a", "b.y.a", "a.z", "b.a.z", "c.z"]
def test_sort_root_domains(self): domains = ["y.a", "z.a", "x.a", "c.z", "b.z", "a.z"] sorted = hosts_tools.sort_domains(domains) assert sorted == ["x.a", "y.a", "z.a", "a.z", "b.z", "c.z"]