def test_delayed_loading(self): pixel_array = pixel_array_factory([[Black]]) class Loader(object): def __init__(self): self.callcount = 0 def __call__(self): self.callcount += 1 return pixel_array, None loader = Loader() image = Image(RGBA, 1, 1, loader) self.assertEqual(loader.callcount, 0) image.set_color(0, 0, White) self.assertEqual(loader.callcount, 1) image.flip_left_right() self.assertEqual(loader.callcount, 1)
def test_delayed_loading(self): pixel_array = pixel_array_factory([ [Black] ]) class Loader(object): def __init__(self): self.callcount = 0 def __call__(self): self.callcount += 1 return pixel_array, None loader = Loader() image = Image(RGBA, 1, 1, loader) self.assertEqual(loader.callcount, 0) image.set_color(0, 0, White) self.assertEqual(loader.callcount, 1) image.flip_left_right() self.assertEqual(loader.callcount, 1)
def loader(): return pixel_array_factory([[Black]]), None