def test_save(): # Arrange with Image.open(TEST_FILE) as im: dummy_fp = None dummy_filename = "dummy.filename" # Act / Assert: stub cannot save without an implemented handler with pytest.raises(OSError): im.save(dummy_filename) with pytest.raises(OSError): Hdf5StubImagePlugin._save(im, dummy_fp, dummy_filename)
def test_save(self): # Arrange im = Image.open(TEST_FILE) dummy_fp = None dummy_filename = "dummy.filename" # Act / Assert: stub cannot save without an implemented handler self.assertRaises(IOError, lambda: im.save(dummy_filename)) self.assertRaises( IOError, lambda: Hdf5StubImagePlugin._save(im, dummy_fp, dummy_filename))