Skip to content

Commit

Permalink
Merge pull request #1680 from radarhere/asserts
Browse files Browse the repository at this point in the history
Updated deprecated asserts
  • Loading branch information
hugovk committed Jan 24, 2016
2 parents ee76e8a + 0ad6f5f commit 3d6e137
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Tests/test_file_tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def test_xyres_tiff(self):
self.assertIsInstance(im.tag[Y_RESOLUTION][0], tuple)

#v2 api
self.assert_(isinstance(im.tag_v2[X_RESOLUTION], TiffImagePlugin.IFDRational))
self.assert_(isinstance(im.tag_v2[Y_RESOLUTION], TiffImagePlugin.IFDRational))
self.assertIsInstance(im.tag_v2[X_RESOLUTION], TiffImagePlugin.IFDRational)
self.assertIsInstance(im.tag_v2[Y_RESOLUTION], TiffImagePlugin.IFDRational)

self.assertEqual(im.info['dpi'], (72., 72.))

Expand Down
32 changes: 16 additions & 16 deletions Tests/test_tiff_ifdrational.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ class Test_IFDRational(PillowTestCase):


def _test_equal(self, num, denom, target):

t = IFDRational(num, denom)

self.assertEqual(target, t)
self.assertEqual(t, target)

def test_sanity(self):

self._test_equal(1, 1, 1)
self._test_equal(1, 1, Fraction(1,1))

Expand All @@ -27,29 +27,29 @@ def test_sanity(self):

self._test_equal(Fraction(1,1), 1, Fraction(1,1))
self._test_equal(IFDRational(1,1), 1, 1)


self._test_equal(1, 2, Fraction(1,2))
self._test_equal(1, 2, IFDRational(1,2))

def test_nonetype(self):
" Fails if the _delegate function doesn't return a valid function"
" Fails if the _delegate function doesn't return a valid function"

xres = IFDRational(72)
yres = IFDRational(72)
self.assertTrue(xres._val is not None)
self.assertTrue(xres.numerator is not None)
self.assertTrue(xres.denominator is not None)
self.assertTrue(yres._val is not None)

xres = IFDRational(72)
yres = IFDRational(72)
self.assert_(xres._val is not None)
self.assert_(xres.numerator is not None)
self.assert_(xres.denominator is not None)
self.assert_(yres._val is not None)

self.assert_(xres and 1)
self.assert_(xres and yres)
self.assertTrue(xres and 1)
self.assertTrue(xres and yres)


def test_ifd_rational_save(self):
for libtiff in (True, False):
TiffImagePlugin.WRITE_LIBTIFF = libtiff

im = hopper()
out = self.tempfile('temp.tiff')
res = IFDRational(301,1)
Expand Down

0 comments on commit 3d6e137

Please sign in to comment.