flake8-ed the tests

This commit is contained in:
Alexis Métaireau 2013-03-03 19:44:57 -08:00
commit 20662c2a43
10 changed files with 158 additions and 146 deletions

View file

@ -10,11 +10,11 @@ from pelican.plugins import gzip_cache
from .test_contents import TEST_CONTENT, TEST_SUMMARY
from .support import unittest, temporary_folder
class TestGzipCache(unittest.TestCase):
'''Unit tests for the gzip cache plugin'''
def test_should_compress(self):
'''Test that some filetypes should compress and others shouldn't.'''
# Some filetypes should compress and others shouldn't.
self.assertTrue(gzip_cache.should_compress('foo.html'))
self.assertTrue(gzip_cache.should_compress('bar.css'))
self.assertTrue(gzip_cache.should_compress('baz.js'))
@ -26,16 +26,17 @@ class TestGzipCache(unittest.TestCase):
self.assertFalse(gzip_cache.should_compress('foo.mov'))
def test_creates_gzip_file(self):
'''Test that a file matching the input filename with a .gz extension is
created.'''
# A file matching the input filename with a .gz extension is created.
# The plugin walks over the output content after the finalized signal
# so it is safe to assume that the file exists (otherwise walk would
# not report it). Therefore, create a dummy file to use.
with temporary_folder() as tempdir:
(_, a_html_filename) = tempfile.mkstemp(suffix='.html', dir=tempdir)
_, a_html_filename = tempfile.mkstemp(suffix='.html', dir=tempdir)
gzip_cache.create_gzip_file(a_html_filename)
self.assertTrue(os.path.exists(a_html_filename + '.gz'))
class TestSummary(unittest.TestCase):
def setUp(self):
super(TestSummary, self).setUp()
@ -92,7 +93,7 @@ class TestSummary(unittest.TestCase):
page_kwargs = self._copy_page_kwargs()
del page_kwargs['metadata']['summary']
page_kwargs['content'] = (
'FOOBAR<!-- PELICAN_BEGIN_SUMMARY -->' + TEST_SUMMARY +
'FOOBAR<!-- PELICAN_BEGIN_SUMMARY -->' + TEST_SUMMARY +
'<!-- PELICAN_END_SUMMARY -->' + TEST_CONTENT)
page = Page(**page_kwargs)
# test both the summary and the marker removal