diff options
Diffstat (limited to 'pelican/tests/test_generators.py')
-rw-r--r-- | pelican/tests/test_generators.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/pelican/tests/test_generators.py b/pelican/tests/test_generators.py index d559cec9..50e08983 100644 --- a/pelican/tests/test_generators.py +++ b/pelican/tests/test_generators.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import locale import os from shutil import copy, rmtree @@ -27,7 +25,7 @@ CONTENT_DIR = os.path.join(CUR_DIR, 'content') class TestGenerator(unittest.TestCase): def setUp(self): self.old_locale = locale.setlocale(locale.LC_ALL) - locale.setlocale(locale.LC_ALL, str('C')) + locale.setlocale(locale.LC_ALL, 'C') self.settings = get_settings() self.settings['READERS'] = {'asc': None} self.generator = Generator(self.settings.copy(), self.settings, @@ -403,7 +401,7 @@ class TestArticlesGenerator(unittest.TestCase): 'period' : a tuple of year, month, day according to the time period """ old_locale = locale.setlocale(locale.LC_ALL) - locale.setlocale(locale.LC_ALL, str('C')) + locale.setlocale(locale.LC_ALL, 'C') settings = get_settings() settings['YEAR_ARCHIVE_SAVE_AS'] = 'posts/{date:%Y}/index.html' @@ -788,7 +786,7 @@ class TestTemplatePagesGenerator(unittest.TestCase): self.temp_content = mkdtemp(prefix='pelicantests.') self.temp_output = mkdtemp(prefix='pelicantests.') self.old_locale = locale.setlocale(locale.LC_ALL) - locale.setlocale(locale.LC_ALL, str('C')) + locale.setlocale(locale.LC_ALL, 'C') def tearDown(self): rmtree(self.temp_content) @@ -823,7 +821,7 @@ class TestTemplatePagesGenerator(unittest.TestCase): self.assertTrue(os.path.exists(output_path)) # output content is correct - with open(output_path, 'r') as output_file: + with open(output_path) as output_file: self.assertEqual(output_file.read(), 'foo: bar') @@ -1013,7 +1011,7 @@ class TestStaticGenerator(unittest.TestCase): f.write("staticcontent") self.generator.generate_context() self.generator.generate_output(None) - with open(self.endfile, "r") as f: + with open(self.endfile) as f: self.assertEqual(f.read(), "staticcontent") @unittest.skipUnless(MagicMock, 'Needs Mock module') @@ -1162,7 +1160,7 @@ class TestJinja2Environment(unittest.TestCase): self.temp_content = mkdtemp(prefix='pelicantests.') self.temp_output = mkdtemp(prefix='pelicantests.') self.old_locale = locale.setlocale(locale.LC_ALL) - locale.setlocale(locale.LC_ALL, str('C')) + locale.setlocale(locale.LC_ALL, 'C') def tearDown(self): rmtree(self.temp_content) @@ -1197,7 +1195,7 @@ class TestJinja2Environment(unittest.TestCase): self.assertTrue(os.path.exists(output_path)) # output content is correct - with open(output_path, 'r') as output_file: + with open(output_path) as output_file: self.assertEqual(output_file.read(), expected) def test_jinja2_filter(self): |