def test_remove(self):
     s = ElementTransformSet(transform=lambda x: x*x)
     with self.assertRaises(KeyError) as cm:
         s.remove(3)
     # Make sure that the KeyError carries the original value,
     # not the transformed value.
     self.assertEqual(cm.exception.args, (3,))
 def test_len(self):
     s = ElementTransformSet(transform=lambda x: x*x + 1)
     self.assertEqual(len(s), 0)
     s.add(4)
     self.assertEqual(len(s), 1)
     s.add(5)
     self.assertEqual(len(s), 2)
     s.remove(-4)
     self.assertEqual(len(s), 1)
     s.remove(-5)
     self.assertEqual(len(s), 0)