mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 16:07:30 +03:00 
			
		
		
		
	Merge pull request #1680 from radarhere/asserts
Updated deprecated asserts
This commit is contained in:
		
						commit
						3d6e137ff2
					
				|  | @ -85,8 +85,8 @@ class TestFileTiff(PillowTestCase): | ||||||
|         self.assertIsInstance(im.tag[Y_RESOLUTION][0], tuple) |         self.assertIsInstance(im.tag[Y_RESOLUTION][0], tuple) | ||||||
| 
 | 
 | ||||||
|         #v2 api |         #v2 api | ||||||
|         self.assert_(isinstance(im.tag_v2[X_RESOLUTION], TiffImagePlugin.IFDRational)) |         self.assertIsInstance(im.tag_v2[X_RESOLUTION], TiffImagePlugin.IFDRational) | ||||||
|         self.assert_(isinstance(im.tag_v2[Y_RESOLUTION], TiffImagePlugin.IFDRational)) |         self.assertIsInstance(im.tag_v2[Y_RESOLUTION], TiffImagePlugin.IFDRational) | ||||||
| 
 | 
 | ||||||
|         self.assertEqual(im.info['dpi'], (72., 72.)) |         self.assertEqual(im.info['dpi'], (72., 72.)) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -11,14 +11,14 @@ class Test_IFDRational(PillowTestCase): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     def _test_equal(self, num, denom, target): |     def _test_equal(self, num, denom, target): | ||||||
|          | 
 | ||||||
|         t = IFDRational(num, denom) |         t = IFDRational(num, denom) | ||||||
| 
 | 
 | ||||||
|         self.assertEqual(target, t) |         self.assertEqual(target, t) | ||||||
|         self.assertEqual(t, target) |         self.assertEqual(t, target) | ||||||
|      | 
 | ||||||
|     def test_sanity(self): |     def test_sanity(self): | ||||||
|          | 
 | ||||||
|         self._test_equal(1, 1, 1) |         self._test_equal(1, 1, 1) | ||||||
|         self._test_equal(1, 1, Fraction(1,1)) |         self._test_equal(1, 1, Fraction(1,1)) | ||||||
| 
 | 
 | ||||||
|  | @ -27,29 +27,29 @@ class Test_IFDRational(PillowTestCase): | ||||||
| 
 | 
 | ||||||
|         self._test_equal(Fraction(1,1), 1, Fraction(1,1)) |         self._test_equal(Fraction(1,1), 1, Fraction(1,1)) | ||||||
|         self._test_equal(IFDRational(1,1), 1, 1) |         self._test_equal(IFDRational(1,1), 1, 1) | ||||||
|          | 
 | ||||||
|          | 
 | ||||||
|         self._test_equal(1, 2, Fraction(1,2)) |         self._test_equal(1, 2, Fraction(1,2)) | ||||||
|         self._test_equal(1, 2, IFDRational(1,2)) |         self._test_equal(1, 2, IFDRational(1,2)) | ||||||
| 
 | 
 | ||||||
|     def test_nonetype(self): |     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)  |         xres = IFDRational(72) | ||||||
|         yres = IFDRational(72)  |         yres = IFDRational(72) | ||||||
|         self.assert_(xres._val is not None) |         self.assertTrue(xres._val is not None) | ||||||
|         self.assert_(xres.numerator is not None) |         self.assertTrue(xres.numerator is not None) | ||||||
|         self.assert_(xres.denominator is not None) |         self.assertTrue(xres.denominator is not None) | ||||||
|         self.assert_(yres._val is not None) |         self.assertTrue(yres._val is not None) | ||||||
|          | 
 | ||||||
|         self.assert_(xres and 1) |         self.assertTrue(xres and 1) | ||||||
|         self.assert_(xres and yres) |         self.assertTrue(xres and yres) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     def test_ifd_rational_save(self): |     def test_ifd_rational_save(self): | ||||||
|         for libtiff in (True, False): |         for libtiff in (True, False): | ||||||
|             TiffImagePlugin.WRITE_LIBTIFF = libtiff |             TiffImagePlugin.WRITE_LIBTIFF = libtiff | ||||||
|              | 
 | ||||||
|             im = hopper() |             im = hopper() | ||||||
|             out = self.tempfile('temp.tiff') |             out = self.tempfile('temp.tiff') | ||||||
|             res = IFDRational(301,1) |             res = IFDRational(301,1) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user