Skip to content

Commit

Permalink
open → io.open
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Mar 26, 2017
1 parent fc8a85a commit e60e87c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_integration.py
Expand Up @@ -284,7 +284,7 @@ def test_relative_links(self):
"""Check that the links in output/index.html are correct"""
test_path = os.path.join(self.target_dir, "output", "index.html")
flag = False
with open(test_path, "rb") as inf:
with io.open(test_path, "rb") as inf:
data = inf.read()
for _, _, url, _ in lxml.html.iterlinks(data):
# Just need to be sure this one is ok
Expand Down Expand Up @@ -406,7 +406,7 @@ def test_relative_links(self):
"""Check that the links in a page are correct"""
test_path = os.path.join(self.target_dir, "output", "about-nikola.html")
flag = False
with open(test_path, "rb") as inf:
with io.open(test_path, "rb") as inf:
data = inf.read()
for _, _, url, _ in lxml.html.iterlinks(data):
# Just need to be sure this one is ok
Expand Down Expand Up @@ -595,23 +595,23 @@ def test_page_index(self):
self.assertTrue(os.path.isfile(os.path.join(subdir2, 'index.html')))

# Do the indexes only contain the pages the should?
with open(os.path.join(pages, 'index.html'), 'r', encoding='utf-8') as fh:
with io.open(os.path.join(pages, 'index.html'), 'r', encoding='utf-8') as fh:
pages_index = fh.read()
self.assertTrue('Page 0' in pages_index)
self.assertTrue('Page 1' not in pages_index)
self.assertTrue('Page 2' not in pages_index)
self.assertTrue('Page 3' not in pages_index)
self.assertTrue('This is not the page index.' not in pages_index)

with open(os.path.join(subdir1, 'index.html'), 'r', encoding='utf-8') as fh:
with io.open(os.path.join(subdir1, 'index.html'), 'r', encoding='utf-8') as fh:
subdir1_index = fh.read()
self.assertTrue('Page 0' not in subdir1_index)
self.assertTrue('Page 1' in subdir1_index)
self.assertTrue('Page 2' in subdir1_index)
self.assertTrue('Page 3' not in subdir1_index)
self.assertTrue('This is not the page index.' not in subdir1_index)

with open(os.path.join(subdir2, 'index.html'), 'r', encoding='utf-8') as fh:
with io.open(os.path.join(subdir2, 'index.html'), 'r', encoding='utf-8') as fh:
subdir2_index = fh.read()
self.assertTrue('Page 0' not in subdir2_index)
self.assertTrue('Page 1' not in subdir2_index)
Expand Down

0 comments on commit e60e87c

Please sign in to comment.