(self)
| 936 | self.assertEqual(a != d, a is not d) |
| 937 | |
| 938 | def test_ordering(self): |
| 939 | # weakrefs cannot be ordered, even if the underlying objects can. |
| 940 | ops = [operator.lt, operator.gt, operator.le, operator.ge] |
| 941 | x = Object(1) |
| 942 | y = Object(1) |
| 943 | a = weakref.ref(x) |
| 944 | b = weakref.ref(y) |
| 945 | for op in ops: |
| 946 | self.assertRaises(TypeError, op, a, b) |
| 947 | # Same when dead. |
| 948 | del x, y |
| 949 | gc.collect() |
| 950 | for op in ops: |
| 951 | self.assertRaises(TypeError, op, a, b) |
| 952 | |
| 953 | def test_hashing(self): |
| 954 | # Alive weakrefs hash the same as the underlying object |
nothing calls this directly
no test coverage detected