(self)
| 1639 | self.assertEqual(actual, expected) |
| 1640 | |
| 1641 | def test_line_with_comment_at_the_end(self): |
| 1642 | # Test with a space as separator. |
| 1643 | for i in range(len(self.domains)): |
| 1644 | data = (b"0.0.0.0 " + self.domains[i] + b" # Hello World").decode("utf-8") |
| 1645 | expected = "0.0.0.0 " + self.expected_domains[i] + " # Hello World" |
| 1646 | |
| 1647 | actual = domain_to_idna(data) |
| 1648 | |
| 1649 | self.assertEqual(actual, expected) |
| 1650 | |
| 1651 | # Test with a tabulation as separator. |
| 1652 | for i in range(len(self.domains)): |
| 1653 | data = (b"0.0.0.0\t" + self.domains[i] + b" # Hello World").decode("utf-8") |
| 1654 | expected = "0.0.0.0\t" + self.expected_domains[i] + " # Hello World" |
| 1655 | |
| 1656 | actual = domain_to_idna(data) |
| 1657 | |
| 1658 | self.assertEqual(actual, expected) |
| 1659 | |
| 1660 | # Test with tabulation as separator of domain and comment. |
| 1661 | for i in range(len(self.domains)): |
| 1662 | data = (b"0.0.0.0\t" + self.domains[i] + b"\t # Hello World").decode( |
| 1663 | "utf-8" |
| 1664 | ) |
| 1665 | expected = "0.0.0.0\t" + self.expected_domains[i] + "\t # Hello World" |
| 1666 | |
| 1667 | actual = domain_to_idna(data) |
| 1668 | |
| 1669 | self.assertEqual(actual, expected) |
| 1670 | |
| 1671 | # Test with space as separator of domain and tabulation as separator |
| 1672 | # of comments. |
| 1673 | for i in range(len(self.domains)): |
| 1674 | data = (b"0.0.0.0 " + self.domains[i] + b" \t # Hello World").decode( |
| 1675 | "utf-8" |
| 1676 | ) |
| 1677 | expected = "0.0.0.0 " + self.expected_domains[i] + " \t # Hello World" |
| 1678 | |
| 1679 | actual = domain_to_idna(data) |
| 1680 | |
| 1681 | self.assertEqual(actual, expected) |
| 1682 | |
| 1683 | # Test with multiple space as separator of domain and space and |
| 1684 | # tabulation as separator or comments. |
| 1685 | for i in range(len(self.domains)): |
| 1686 | data = (b"0.0.0.0 " + self.domains[i] + b" \t # Hello World").decode( |
| 1687 | "utf-8" |
| 1688 | ) |
| 1689 | expected = "0.0.0.0 " + self.expected_domains[i] + " \t # Hello World" |
| 1690 | |
| 1691 | actual = domain_to_idna(data) |
| 1692 | |
| 1693 | self.assertEqual(actual, expected) |
| 1694 | |
| 1695 | # Test with multiple tabulations as separator of domain and space and |
| 1696 | # tabulation as separator or comments. |
| 1697 | for i, domain in enumerate(self.domains): |
| 1698 | data = (b"0.0.0.0\t\t\t" + domain + b" \t # Hello World").decode( |
nothing calls this directly
no test coverage detected