forked from github/pelican
Modernize code base to Python 3+ syntax
Replaces syntax that was relevant in earlier Python versions but that now has modernized equivalents.
This commit is contained in:
parent
2cd1d44576
commit
d43b786b30
37 changed files with 104 additions and 171 deletions
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import locale
|
||||
import os
|
||||
import re
|
||||
|
|
@ -41,7 +39,7 @@ class TestBloggerXmlImporter(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.posts = blogger2fields(BLOGGER_XML_SAMPLE)
|
||||
|
||||
def tearDown(self):
|
||||
|
|
@ -90,7 +88,7 @@ class TestWordpressXmlImporter(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.posts = wp2fields(WORDPRESS_XML_SAMPLE)
|
||||
self.custposts = wp2fields(WORDPRESS_XML_SAMPLE, True)
|
||||
|
||||
|
|
@ -282,9 +280,9 @@ class TestWordpressXmlImporter(unittest.TestCase):
|
|||
|
||||
def test_decode_wp_content(self):
|
||||
""" Check that we can decode a wordpress content string."""
|
||||
with open(WORDPRESS_ENCODED_CONTENT_SAMPLE, 'r') as encoded_file:
|
||||
with open(WORDPRESS_ENCODED_CONTENT_SAMPLE) as encoded_file:
|
||||
encoded_content = encoded_file.read()
|
||||
with open(WORDPRESS_DECODED_CONTENT_SAMPLE, 'r') as decoded_file:
|
||||
with open(WORDPRESS_DECODED_CONTENT_SAMPLE) as decoded_file:
|
||||
decoded_content = decoded_file.read()
|
||||
self.assertEqual(
|
||||
decode_wp_content(encoded_content, br=False),
|
||||
|
|
@ -405,7 +403,7 @@ class TestBuildHeader(unittest.TestCase):
|
|||
class TestWordpressXMLAttachements(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.attachments = get_attachments(WORDPRESS_XML_SAMPLE)
|
||||
|
||||
def tearDown(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue