mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-03 11:35:52 +03:00
Refactor and add two more tests
This commit is contained in:
parent
775307113b
commit
b6f836b5b8
|
@ -5,10 +5,10 @@ import os.path
|
|||
|
||||
class TestFilePalm(PillowTestCase):
|
||||
|
||||
def test_save_palm_p(self):
|
||||
def helper_save_as_palm(self, mode):
|
||||
# Arrange
|
||||
im = lena("P")
|
||||
outfile = self.tempfile('temp_p.palm')
|
||||
im = lena(mode)
|
||||
outfile = self.tempfile("temp_" + mode + ".palm")
|
||||
|
||||
# Act
|
||||
im.save(outfile)
|
||||
|
@ -17,6 +17,27 @@ class TestFilePalm(PillowTestCase):
|
|||
self.assertTrue(os.path.isfile(outfile))
|
||||
self.assertGreater(os.path.getsize(outfile), 0)
|
||||
|
||||
def test_monochrome(self):
|
||||
# Arrange
|
||||
mode = "1"
|
||||
|
||||
# Act / Assert
|
||||
self.helper_save_as_palm(mode)
|
||||
|
||||
def test_p_mode(self):
|
||||
# Arrange
|
||||
mode = "P"
|
||||
|
||||
# Act / Assert
|
||||
self.helper_save_as_palm(mode)
|
||||
|
||||
def test_rgb_ioerror(self):
|
||||
# Arrange
|
||||
mode = "RGB"
|
||||
|
||||
# Act / Assert
|
||||
self.assertRaises(IOError, lambda: self.helper_save_as_palm(mode))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue
Block a user