def test_first_object_kept(self):
     a, b = float("nan"), float("nan")
     self.assertTrue(a is not b)  #prerequisite
     s = PyObjectMap()
     s[a] = a
     s[b] = b
     lst = list(s.items())
     self.assertEqual(len(lst), 1)
     self.assertTrue(a is lst[0][0])
 def test_map_interator_right_refcnts(self):
     a = 4200
     s = PyObjectMap()
     old_ref_cnt = sys.getrefcount(a)
     s[a] = a
     self.assertEqual(sys.getrefcount(a), old_ref_cnt + 2)
     lst = list(s.items())
     # now also lst helds two additional references
     self.assertEqual(sys.getrefcount(a), old_ref_cnt + 4)