Browse Source

PIL requirement added

main
Lakshmi Vyasarajan 13 years ago
parent
commit
7bca6edadf
4 changed files with 9 additions and 4 deletions
  1. +0
    -1
      TODO.rst
  2. +1
    -0
      dev-req.txt
  3. +2
    -0
      hyde/ext/plugins/images.py
  4. +6
    -3
      hyde/tests/ext/test_images.py

+ 0
- 1
TODO.rst View File

@@ -1,3 +1,2 @@
* Unit test for Language plugin * Unit test for Language plugin
* Unit test for Image size plugin
* Unit test for git dates plugin * Unit test for git dates plugin

+ 1
- 0
dev-req.txt View File

@@ -13,3 +13,4 @@ nose==1.0.0
pep8==0.6.1 pep8==0.6.1
pylint==0.22.0 pylint==0.22.0
pysmell==0.7.3 pysmell==0.7.3
PIL

+ 2
- 0
hyde/ext/plugins/images.py View File

@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Contains classes to handle images related things Contains classes to handle images related things

# Requires PIL
""" """


from hyde.plugin import Plugin from hyde.plugin import Plugin


+ 6
- 3
hyde/tests/ext/test_images.py View File

@@ -3,6 +3,8 @@
Use nose Use nose
`$ pip install nose` `$ pip install nose`
`$ nosetests` `$ nosetests`

Requires PIL
""" """
from hyde.fs import File, Folder from hyde.fs import File, Folder
from hyde.generator import Generator from hyde.generator import Generator
@@ -15,6 +17,9 @@ IMAGE_SOURCE = File(__file__).parent.child_folder('optipng')
IMAGE_NAME = "hyde-lt-b.png" IMAGE_NAME = "hyde-lt-b.png"
IMAGE_SIZE = (538, 132) IMAGE_SIZE = (538, 132)


# PIL requirement
import Image

class TestImageSizer(object): class TestImageSizer(object):


def setUp(self): def setUp(self):
@@ -83,9 +88,7 @@ class TestImageSizer(object):


def test_size_image_multiline(self): def test_size_image_multiline(self):
text = u""" text = u"""
<img
src="/media/img/%s"
>
<img src="/media/img/%s">
""" % IMAGE_NAME """ % IMAGE_NAME
html = self._generic_test_image(text) html = self._generic_test_image(text)
assert ' width="%d"' % IMAGE_SIZE[0] in html assert ' width="%d"' % IMAGE_SIZE[0] in html


Loading…
Cancel
Save