| 1754 | |
| 1755 | @pytest.mark.parametrize("op", ["eq", "ne", "le", "lt", "ge", "gt"]) |
| 1756 | def test_struct_compare_errors(self, op): |
| 1757 | func = getattr(operator, op) |
| 1758 | |
| 1759 | class Bad: |
| 1760 | def __eq__(self, other): |
| 1761 | raise ValueError("Oh no!") |
| 1762 | |
| 1763 | class Test(Struct, order=True): |
| 1764 | a: object |
| 1765 | b: object |
| 1766 | |
| 1767 | t = Test(1, Bad()) |
| 1768 | t2 = Test(1, 2) |
| 1769 | |
| 1770 | with pytest.raises(ValueError, match="Oh no!"): |
| 1771 | func(t, t2) |
| 1772 | with pytest.raises(ValueError, match="Oh no!"): |
| 1773 | func(t2, t) |
| 1774 | |
| 1775 | |
| 1776 | class TestTagAndTagField: |