|
@@ -1,4 +1,3 @@
|
|
|
-import io # fixme: remove explicit io imports after going py3k-only
|
|
|
import os
|
|
|
from collections import OrderedDict
|
|
|
|
|
@@ -62,7 +61,7 @@ class DataArchiveTests(AuthenticatedUserTestCase):
|
|
|
valid_output_path = os.path.join(archive.data_dir_path, 'testfile.txt')
|
|
|
self.assertEqual(file_path, valid_output_path)
|
|
|
|
|
|
- with io.open(file_path, 'r', encoding="utf-8") as fp:
|
|
|
+ with open(file_path, 'r') as fp:
|
|
|
saved_data = fp.read().strip()
|
|
|
self.assertEqual(saved_data, data_to_write)
|
|
|
|
|
@@ -76,7 +75,7 @@ class DataArchiveTests(AuthenticatedUserTestCase):
|
|
|
valid_output_path = os.path.join(archive.data_dir_path, 'testfile.txt')
|
|
|
self.assertEqual(file_path, valid_output_path)
|
|
|
|
|
|
- with io.open(file_path, 'r', encoding="utf-8") as fp:
|
|
|
+ with open(file_path, 'r') as fp:
|
|
|
saved_data = fp.read().strip()
|
|
|
self.assertEqual(saved_data, str(data_to_write))
|
|
|
|
|
@@ -90,7 +89,7 @@ class DataArchiveTests(AuthenticatedUserTestCase):
|
|
|
valid_output_path = os.path.join(archive.data_dir_path, 'testfile.txt')
|
|
|
self.assertEqual(file_path, valid_output_path)
|
|
|
|
|
|
- with io.open(file_path, 'r', encoding="utf-8") as fp:
|
|
|
+ with open(file_path, 'r') as fp:
|
|
|
saved_data = fp.read().strip()
|
|
|
# order of dict items in py<3.6 is non-deterministic
|
|
|
# making testing for exact match a mistake
|
|
@@ -107,13 +106,13 @@ class DataArchiveTests(AuthenticatedUserTestCase):
|
|
|
valid_output_path = os.path.join(archive.data_dir_path, 'testfile.txt')
|
|
|
self.assertEqual(file_path, valid_output_path)
|
|
|
|
|
|
- with io.open(file_path, 'r', encoding="utf-8") as fp:
|
|
|
+ with open(file_path, 'r') as fp:
|
|
|
saved_data = fp.read().strip()
|
|
|
self.assertEqual(saved_data, "first: łorld!\nsecond: łup!")
|
|
|
|
|
|
def test_add_model_file(self):
|
|
|
"""add_model_file method adds model file"""
|
|
|
- with io.open(TEST_AVATAR_PATH, 'rb') as avatar:
|
|
|
+ with open(TEST_AVATAR_PATH, 'rb') as avatar:
|
|
|
self.user.avatar_tmp = File(avatar)
|
|
|
self.user.save()
|
|
|
|
|
@@ -135,7 +134,7 @@ class DataArchiveTests(AuthenticatedUserTestCase):
|
|
|
|
|
|
def test_add_model_file_prefixed(self):
|
|
|
"""add_model_file method adds model file with prefix"""
|
|
|
- with io.open(TEST_AVATAR_PATH, 'rb') as avatar:
|
|
|
+ with open(TEST_AVATAR_PATH, 'rb') as avatar:
|
|
|
self.user.avatar_tmp = File(avatar)
|
|
|
self.user.save()
|
|
|
|
|
@@ -205,7 +204,7 @@ class DataArchiveTests(AuthenticatedUserTestCase):
|
|
|
"""get_file returns django file"""
|
|
|
django_file = None
|
|
|
|
|
|
- with io.open(TEST_AVATAR_PATH, 'rb') as avatar:
|
|
|
+ with open(TEST_AVATAR_PATH, 'rb') as avatar:
|
|
|
self.user.avatar_tmp = File(avatar)
|
|
|
self.user.save()
|
|
|
|