Kaydet (Commit) a397c00b authored tarafından Batuhan Taşkaya's avatar Batuhan Taşkaya

bpo-36949: Implement __repr__ on WeakSet

üst f665b96e
...@@ -194,3 +194,6 @@ class WeakSet: ...@@ -194,3 +194,6 @@ class WeakSet:
def isdisjoint(self, other): def isdisjoint(self, other):
return len(self.intersection(other)) == 0 return len(self.intersection(other)) == 0
def __repr__(self):
return repr(self.data)
...@@ -434,6 +434,9 @@ class TestWeakSet(unittest.TestCase): ...@@ -434,6 +434,9 @@ class TestWeakSet(unittest.TestCase):
self.assertGreaterEqual(n2, 0) self.assertGreaterEqual(n2, 0)
self.assertLessEqual(n2, n1) self.assertLessEqual(n2, n1)
def test_repr(self):
assert repr(self.s) == repr(self.s.data)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment