def test_lazy_items(self): d = LazyDict() d.set_stub(1, lambda x:x) self.assertEqual(set(d.items()), {(1, 1)}) d = LazyDict({1:2}) d.set_stub(2, lambda x:x) self.assertEqual(set(d.items()), {(1, 2), (2, 2)})
def test_items(self): d = LazyDict() self.assertEqual(set(d.items()), set()) d = LazyDict({1:2}) self.assertEqual(set(d.items()), {(1, 2)}) self.assertRaises(TypeError, d.items, None)