コード例 #1
0
 def testSubdir(self):
     """Test a file that is in a sub-directory of img_path."""
     r = Resizer('square', '100', self.img_path)
     new_name = r.get_thumbnail_name(self.path('subdir', 'sample_image.jpg'))
     self.assertEqual('subdir/sample_image_square.jpg', new_name)
コード例 #2
0
 def testRoot(self):
     """Test a file that is in the root of img_path."""
     r = Resizer('square', '100', self.img_path)
     new_name = r.get_thumbnail_name(self.path('sample_image.jpg'))
     self.assertEqual('sample_image_square.jpg', new_name)
コード例 #3
0
 def testRootWithSlash(self):
     r = Resizer('square', '100', self.img_path + '/')
     new_name = r.get_thumbnail_name(self.path('sample_image.jpg'))
     self.assertEqual('sample_image_square.jpg', new_name)
コード例 #4
0
 def testWidth(self):
     r = Resizer('aspect', '250x?', self.img_path)
     output = r.resize(self.img)
     self.assertEqual((250, 166), output.size)
コード例 #5
0
 def testHeight(self):
     r = Resizer('aspect', '?x250', self.img_path)
     output = r.resize(self.img)
     self.assertEqual((375, 250), output.size)
コード例 #6
0
 def testSquare(self):
     r = Resizer('square', '100', self.img_path)
     output = r.resize(self.img)
     self.assertEqual((100, 100), output.size)
コード例 #7
0
 def testExact(self):
     r = Resizer('exact', '250x100', self.img_path)
     output = r.resize(self.img)
     self.assertEqual((250, 100), output.size)
コード例 #8
0
 def testSubdir(self):
     """Test a file that is in a sub-directory of img_path."""
     r = Resizer("square", "100", self.img_path)
     new_name = r.get_thumbnail_name(self.path("subdir",
                                               "sample_image.jpg"))
     self.assertEqual("subdir/sample_image_square.jpg", new_name)
コード例 #9
0
 def testRootWithSlash(self):
     r = Resizer("square", "100", self.img_path + "/")
     new_name = r.get_thumbnail_name(self.path("sample_image.jpg"))
     self.assertEqual("sample_image_square.jpg", new_name)
コード例 #10
0
 def testRoot(self):
     """Test a file that is in the root of img_path."""
     r = Resizer("square", "100", self.img_path)
     new_name = r.get_thumbnail_name(self.path("sample_image.jpg"))
     self.assertEqual("sample_image_square.jpg", new_name)
コード例 #11
0
 def testExact(self):
     r = Resizer("exact", "250x100", self.img_path)
     output = r.resize(self.img)
     self.assertEqual((250, 100), output.size)
コード例 #12
0
 def testSquare(self):
     r = Resizer("square", "100", self.img_path)
     output = r.resize(self.img)
     self.assertEqual((100, 100), output.size)