Пример #1
0
 def test_basic(self):
     filename = namers.default(
         thumbnailer=FakeThumbnailer(),
         prepared_options=['100x100', 'q80', 'crop', 'upscale'],
         source_filename='source.jpg',
         thumbnail_extension='jpg',
     )
     self.assertEqual(filename, 'source.jpg.100x100_q80_crop_upscale.jpg')
Пример #2
0
 def test_basedir_opts(self):
     filename = namers.default(
         thumbnailer=FakeThumbnailer(basedir='%(opts)s'),
         prepared_options=['100x100', 'q80', 'crop', 'upscale'],
         source_filename='source.gif',
         thumbnail_extension='png',
     )
     self.assertEqual(filename, 'source.gif.png')
Пример #3
0
 def test_basedir_opts(self):
     filename = namers.default(
         thumbnailer=FakeThumbnailer(basedir='%(opts)s'),
         prepared_options=['100x100', 'q80', 'crop', 'upscale'],
         source_filename='source.gif',
         thumbnail_extension='png',
     )
     self.assertEqual(filename, 'source.gif.png')
Пример #4
0
 def test_basic(self):
     filename = namers.default(
         thumbnailer=FakeThumbnailer(),
         prepared_options=['100x100', 'q80', 'crop', 'upscale'],
         source_filename='source.jpg',
         thumbnail_extension='jpg',
     )
     self.assertEqual(filename, 'source.jpg.100x100_q80_crop_upscale.jpg')
Пример #5
0
 def test_basedir_opts(self):
     filename = namers.default(
         thumbnailer=FakeThumbnailer(basedir="%(opts)s"),
         prepared_options=["100x100", "q80", "crop", "upscale"],
         source_filename="source.gif",
         thumbnail_extension="png",
     )
     self.assertEqual(filename, "source.gif.png")
Пример #6
0
 def test_basic(self):
     filename = namers.default(
         thumbnailer=FakeThumbnailer(),
         prepared_options=["100x100", "q80", "crop", "upscale"],
         source_filename="source.jpg",
         thumbnail_extension="jpg",
     )
     self.assertEqual(filename, "source.jpg.100x100_q80_crop_upscale.jpg")
Пример #7
0
def default(thumbnailer, prepared_options, source_filename, thumbnail_extension, **kwargs):
	fmt = kwargs.get('thumbnail_options', {}).get('format')
	if fmt:
		thumbnail_extension = fmt
	return namers.default(thumbnailer, prepared_options, source_filename, thumbnail_extension, **kwargs)