def test_default_factory(self):
     d = KeyTransformDict(transform=abs, default_factory=list)
     d[2].append(4)
     d[-2].append(5)
     self.assertIn(-2, d)
     self.assertEqual(d[2], [4, 5])
     self.assertEqual(list(d.items()), [(2, [4, 5])])
 def test_len(self):
     d = KeyTransformDict(transform=abs)
     self.assertEqual(len(d), 0)
     d[13] = 2
     self.assertEqual(len(d), 1)
     d[-14] = 5
     self.assertEqual(len(d), 2)
     d[-13] = 3
     self.assertEqual(len(d), 2)
     result = d.pop(13)
     self.assertEqual(result, 3)
     self.assertEqual(len(d), 1)
     del d[14]
     self.assertEqual(len(d), 0)