Python 3.6 compatibility: Applied 2to3
This commit is contained in:
@@ -57,13 +57,13 @@ class ShotManagerTest(AbstractShotTest):
|
||||
shot1_id = shot1['_id']
|
||||
shot2_id = shot2['_id']
|
||||
|
||||
task1 = self.create_task(shot1_id, u'fx')
|
||||
task2 = self.create_task(shot1_id, u'fx')
|
||||
task3 = self.create_task(shot1_id, u'høken')
|
||||
task1 = self.create_task(shot1_id, 'fx')
|
||||
task2 = self.create_task(shot1_id, 'fx')
|
||||
task3 = self.create_task(shot1_id, 'høken')
|
||||
|
||||
task4 = self.create_task(shot2_id, u'effects')
|
||||
task5 = self.create_task(shot2_id, u'effects')
|
||||
task6 = self.create_task(shot2_id, u'ïnžane')
|
||||
task4 = self.create_task(shot2_id, 'effects')
|
||||
task5 = self.create_task(shot2_id, 'effects')
|
||||
task6 = self.create_task(shot2_id, 'ïnžane')
|
||||
|
||||
with self.app.test_request_context():
|
||||
# Log in as project admin user
|
||||
@@ -71,7 +71,7 @@ class ShotManagerTest(AbstractShotTest):
|
||||
|
||||
self.mock_blenderid_validate_happy()
|
||||
shot_id_to_task = self.smngr.tasks_for_nodes([shot1, shot2],
|
||||
[u'fx', u'høken', u'effects'])
|
||||
['fx', 'høken', 'effects'])
|
||||
|
||||
# Just test based on task IDs, as strings are turned into datetimes etc. by the API,
|
||||
# so we can't test equality.
|
||||
@@ -80,12 +80,12 @@ class ShotManagerTest(AbstractShotTest):
|
||||
all_tasks[task_type] = {task['_id'] for task in tasks}
|
||||
|
||||
self.assertEqual({
|
||||
u'fx': {task1['_id'], task2['_id']},
|
||||
u'høken': {task3['_id']},
|
||||
'fx': {task1['_id'], task2['_id']},
|
||||
'høken': {task3['_id']},
|
||||
}, shot_id_to_task[shot1_id])
|
||||
|
||||
self.assertEqual({
|
||||
u'effects': {task4['_id'], task5['_id']},
|
||||
'effects': {task4['_id'], task5['_id']},
|
||||
None: {task6['_id']},
|
||||
}, shot_id_to_task[shot2_id])
|
||||
|
||||
@@ -110,8 +110,8 @@ class ShotManagerTest(AbstractShotTest):
|
||||
# _etag='jemoeder')
|
||||
|
||||
self.smngr.edit_shot(shot_id=shot['_id'],
|
||||
name=u'ผัดไทย',
|
||||
description=u'Shoot the Pad Thai',
|
||||
name='ผัดไทย',
|
||||
description='Shoot the Pad Thai',
|
||||
status='todo',
|
||||
notes=None,
|
||||
_etag=shot._etag)
|
||||
@@ -121,9 +121,9 @@ class ShotManagerTest(AbstractShotTest):
|
||||
nodes_coll = self.app.data.driver.db['nodes']
|
||||
found = nodes_coll.find_one(ObjectId(shot['_id']))
|
||||
self.assertEqual(pre_edit_shot['name'], found['name']) # shouldn't be edited.
|
||||
self.assertEqual(u'todo', found['properties']['status'])
|
||||
self.assertEqual(u'Shoot the Pad Thai', found['description'])
|
||||
self.assertNotIn(u'notes', found['properties'])
|
||||
self.assertEqual('todo', found['properties']['status'])
|
||||
self.assertEqual('Shoot the Pad Thai', found['description'])
|
||||
self.assertNotIn('notes', found['properties'])
|
||||
|
||||
@responses.activate
|
||||
def test_shot_summary(self):
|
||||
@@ -156,21 +156,21 @@ class PatchShotTest(AbstractShotTest):
|
||||
patch = {
|
||||
'op': 'from-blender',
|
||||
'$set': {
|
||||
'name': u'"shot" is "geschoten" in Dutch',
|
||||
'name': '"shot" is "geschoten" in Dutch',
|
||||
'properties.trim_start_in_frames': 123,
|
||||
'properties.trim_end_in_frames': 0,
|
||||
'properties.duration_in_edit_in_frames': 4215,
|
||||
'properties.cut_in_timeline_in_frames': 1245,
|
||||
'properties.status': u'on_hold',
|
||||
'properties.status': 'on_hold',
|
||||
}
|
||||
}
|
||||
self.patch(url, json=patch, auth_token='token')
|
||||
|
||||
dbnode = self.get(url, auth_token='token').json()
|
||||
self.assertEqual(u'"shot" is "geschoten" in Dutch', dbnode['name'])
|
||||
self.assertEqual('"shot" is "geschoten" in Dutch', dbnode['name'])
|
||||
self.assertEqual(123, dbnode['properties']['trim_start_in_frames'])
|
||||
self.assertEqual(0, dbnode['properties']['trim_end_in_frames'])
|
||||
self.assertEqual(u'on_hold', dbnode['properties']['status'])
|
||||
self.assertEqual('on_hold', dbnode['properties']['status'])
|
||||
|
||||
@responses.activate
|
||||
def test_patch_activity(self):
|
||||
@@ -182,7 +182,7 @@ class PatchShotTest(AbstractShotTest):
|
||||
|
||||
# Only change the name -- the activity should contain both the old and the new name.
|
||||
old_name = shot['name']
|
||||
new_name = u'"shot" is "geschoten" in Dutch'
|
||||
new_name = '"shot" is "geschoten" in Dutch'
|
||||
patch = {
|
||||
'op': 'from-blender',
|
||||
'$set': {
|
||||
@@ -209,20 +209,20 @@ class PatchShotTest(AbstractShotTest):
|
||||
patch = {
|
||||
'op': 'from-web',
|
||||
'$set': {
|
||||
'description': u'Таким образом, этот человек заходит в бар, и говорит…',
|
||||
'properties.notes': u'Два бокала вашей лучшей водки, пожалуйста.',
|
||||
'properties.status': u'final',
|
||||
'description': 'Таким образом, этот человек заходит в бар, и говорит…',
|
||||
'properties.notes': 'Два бокала вашей лучшей водки, пожалуйста.',
|
||||
'properties.status': 'final',
|
||||
}
|
||||
}
|
||||
self.patch(url, json=patch, auth_token='token')
|
||||
|
||||
dbnode = self.get(url, auth_token='token').json()
|
||||
self.assertEqual(u'Таким образом, этот человек заходит в бар, и говорит…',
|
||||
self.assertEqual('Таким образом, этот человек заходит в бар, и говорит…',
|
||||
dbnode['description'])
|
||||
self.assertEqual(u'Два бокала вашей лучшей водки, пожалуйста.',
|
||||
self.assertEqual('Два бокала вашей лучшей водки, пожалуйста.',
|
||||
dbnode['properties']['notes'])
|
||||
self.assertEqual(u'final', dbnode['properties']['status'])
|
||||
self.assertEqual(u'New shot', dbnode['name'])
|
||||
self.assertEqual('final', dbnode['properties']['status'])
|
||||
self.assertEqual('New shot', dbnode['name'])
|
||||
|
||||
@responses.activate
|
||||
def test_patch_from_web_happy_nones(self):
|
||||
@@ -235,7 +235,7 @@ class PatchShotTest(AbstractShotTest):
|
||||
'$set': {
|
||||
'description': None,
|
||||
'properties.notes': None,
|
||||
'properties.status': u'final',
|
||||
'properties.status': 'final',
|
||||
}
|
||||
}
|
||||
self.patch(url, json=patch, auth_token='token')
|
||||
@@ -243,8 +243,8 @@ class PatchShotTest(AbstractShotTest):
|
||||
dbnode = self.get(url, auth_token='token').json()
|
||||
self.assertNotIn('description', dbnode)
|
||||
self.assertNotIn('notes', dbnode['properties'])
|
||||
self.assertEqual(u'final', dbnode['properties']['status'])
|
||||
self.assertEqual(u'New shot', dbnode['name'])
|
||||
self.assertEqual('final', dbnode['properties']['status'])
|
||||
self.assertEqual('New shot', dbnode['name'])
|
||||
|
||||
@responses.activate
|
||||
def test_patch_bad_op(self):
|
||||
@@ -409,15 +409,15 @@ class RequiredAfterCreationTest(AbstractShotTest):
|
||||
|
||||
node_type_name = node_type_shot['name']
|
||||
|
||||
shot = {'name': u'test shot',
|
||||
'description': u'',
|
||||
'properties': {u'trim_start_in_frames': 0,
|
||||
u'trim_end_in_frames': 0,
|
||||
u'duration_in_edit_in_frames': 1,
|
||||
u'cut_in_timeline_in_frames': 0},
|
||||
shot = {'name': 'test shot',
|
||||
'description': '',
|
||||
'properties': {'trim_start_in_frames': 0,
|
||||
'trim_end_in_frames': 0,
|
||||
'duration_in_edit_in_frames': 1,
|
||||
'cut_in_timeline_in_frames': 0},
|
||||
'node_type': node_type_name,
|
||||
'project': unicode(self.proj_id),
|
||||
'user': unicode(self.user_id)}
|
||||
'project': str(self.proj_id),
|
||||
'user': str(self.user_id)}
|
||||
|
||||
resp = self.post('/api/nodes', json=shot,
|
||||
auth_token='token', expected_status=201)
|
||||
@@ -441,27 +441,27 @@ class ProjectSummaryTest(unittest.TestCase):
|
||||
from attract.shots_and_assets import ProjectSummary
|
||||
|
||||
self.summ = ProjectSummary()
|
||||
self.summ.count(u'todo')
|
||||
self.summ.count(u'todo')
|
||||
self.summ.count(u'in-progress')
|
||||
self.summ.count(u'überhard')
|
||||
self.summ.count(u'Æon Flux')
|
||||
self.summ.count(u'Æon Flux')
|
||||
self.summ.count(u'in-progress')
|
||||
self.summ.count(u'todo')
|
||||
self.summ.count('todo')
|
||||
self.summ.count('todo')
|
||||
self.summ.count('in-progress')
|
||||
self.summ.count('überhard')
|
||||
self.summ.count('Æon Flux')
|
||||
self.summ.count('Æon Flux')
|
||||
self.summ.count('in-progress')
|
||||
self.summ.count('todo')
|
||||
|
||||
def test_counting(self):
|
||||
self.assertEqual(8, self.summ._total)
|
||||
self.assertEqual(3, self.summ._counts[u'todo'])
|
||||
self.assertEqual(2, self.summ._counts[u'Æon Flux'])
|
||||
self.assertEqual(3, self.summ._counts['todo'])
|
||||
self.assertEqual(2, self.summ._counts['Æon Flux'])
|
||||
|
||||
def test_percentages(self):
|
||||
percs = list(self.summ.percentages())
|
||||
|
||||
self.assertEqual((u'in-progress', 25), percs[0])
|
||||
self.assertEqual((u'todo', 38), percs[1])
|
||||
self.assertEqual((u'Æon Flux', 25), percs[2])
|
||||
self.assertEqual(('in-progress', 25), percs[0])
|
||||
self.assertEqual(('todo', 38), percs[1])
|
||||
self.assertEqual(('Æon Flux', 25), percs[2])
|
||||
|
||||
# This should be rounded down, not rounded up, to ensure the sum of
|
||||
# percentages is 100.
|
||||
self.assertEqual((u'überhard', 12), percs[3])
|
||||
self.assertEqual(('überhard', 12), percs[3])
|
||||
|
Reference in New Issue
Block a user