From 807b2aed75c7d791df95687dd88d1f894fe3d9b7 Mon Sep 17 00:00:00 2001 From: Zulqarnain Date: Fri, 26 Jun 2020 11:23:25 +0500 Subject: [PATCH] Run 2to3 --- ccx_keys/locator.py | 4 +--- ccx_keys/tests/test_ccx_keys.py | 13 ++++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ccx_keys/locator.py b/ccx_keys/locator.py index 3b04c3c..2dccba9 100644 --- a/ccx_keys/locator.py +++ b/ccx_keys/locator.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- """ Locator module. """ -from __future__ import unicode_literals - import re from opaque_keys import InvalidKeyError @@ -93,7 +91,7 @@ def _to_string(self): """ string = super(CCXLocator, self)._to_string() # append the identifier for the ccx to the existing course string - string += u"+{prefix}@{ccx}".format( + string += "+{prefix}@{ccx}".format( prefix=self.CCX_PREFIX, ccx=self.ccx ) return string diff --git a/ccx_keys/tests/test_ccx_keys.py b/ccx_keys/tests/test_ccx_keys.py index 898d9f5..98b0952 100644 --- a/ccx_keys/tests/test_ccx_keys.py +++ b/ccx_keys/tests/test_ccx_keys.py @@ -1,5 +1,4 @@ """ Tests for the ccx_keys package. """ - import six import ddt import itertools # pylint: disable=wrong-import-order @@ -137,7 +136,7 @@ def test_missing_ccx_id(self, fields): 'branch': 'draft-1', } use_fields = dict( - (k, v) for k, v in available_fields.items() if k in fields + (k, v) for k, v in list(available_fields.items()) if k in fields ) with self.assertRaises(InvalidKeyError) as context_manager: CCXLocator(**use_fields) @@ -184,7 +183,7 @@ def test_locator_from_good_url(self, fields, url_template): this_url = url_template.format(**available_fields) testobj = CourseKey.from_string(this_url) use_keys = dict( - (k, v) for k, v in available_fields.items() if k in fields + (k, v) for k, v in list(available_fields.items()) if k in fields ) if 'version_guid' in use_keys: @@ -236,7 +235,7 @@ def test_from_course_locator_constructor(self, fields): 'branch': 'draft-1', } ccx = '1' - use_fields = dict((k, v) for k, v in available_fields.items() if k in fields) + use_fields = dict((k, v) for k, v in list(available_fields.items()) if k in fields) course_id = CourseLocator(**use_fields) testobj = CCXLocator.from_course_locator(course_id, ccx) @@ -329,8 +328,8 @@ def test_valid_locations(self, org, course, run, ccx, category, name, revision): (["foo", "bar", "baz", "blat:blat", "foo:bar"], {}), # ':' ok in name, not in category (('org', 'course', 'run', 'category', 'name with spaces', 'revision'), {}), (('org', 'course', 'run', 'category', 'name/with/slashes', 'revision'), {}), - (('org', 'course', 'run', 'category', 'name', u'\xae'), {}), - (('org', 'course', 'run', 'category', u'\xae', 'revision'), {}), + (('org', 'course', 'run', 'category', 'name', '\xae'), {}), + (('org', 'course', 'run', 'category', '\xae', 'revision'), {}), ((), { 'tag': 'tag', 'course': 'course', @@ -371,7 +370,7 @@ def test_replacement(self, key, newvalue): ) with self.assertRaises(InvalidKeyError): - CCXBlockUsageLocator(course_key, 'c', 'n', deprecated=True).replace(block_id=u'name\xae') + CCXBlockUsageLocator(course_key, 'c', 'n', deprecated=True).replace(block_id='name\xae') def test_map_into_course_location(self): original_course = CCXLocator(org='org', course='course', run='run', ccx='1')