| 140 | |
| 141 | |
| 142 | def test_overriding_eq_reset_hash(): |
| 143 | assert m.Comparable(15) is not m.Comparable(15) |
| 144 | assert m.Comparable(15) == m.Comparable(15) |
| 145 | |
| 146 | with pytest.raises(TypeError) as excinfo: |
| 147 | hash(m.Comparable(15)) |
| 148 | assert str(excinfo.value).startswith("unhashable type:") |
| 149 | |
| 150 | for hashable in (m.Hashable, m.Hashable2): |
| 151 | assert hashable(15) is not hashable(15) |
| 152 | assert hashable(15) == hashable(15) |
| 153 | |
| 154 | assert hash(hashable(15)) == 15 |
| 155 | assert hash(hashable(15)) == hash(hashable(15)) |
| 156 | |
| 157 | |
| 158 | def test_return_set_of_unhashable(): |