random.shuffle compatibility fix between python 2.7 and 3.5

This commit is contained in:
jinder1s
2019-09-26 08:47:18 -04:00
parent 4b64a44c3a
commit 7a2aaa09c1

View File

@@ -3,6 +3,7 @@ from __future__ import absolute_import, print_function
import textwrap
import unittest
import six
from capa.responsetypes import LoncapaProblemError
from capa.tests.helpers import new_loncapa_problem, test_capa_system
@@ -58,7 +59,10 @@ class CapaShuffleTest(unittest.TestCase):
response = list(problem.responders.values())[0]
self.assertFalse(response.has_mask())
self.assertTrue(response.has_shuffle())
self.assertEqual(response.unmask_order(), ['choice_0', 'choice_aaa', 'choice_1', 'choice_ddd'])
if six.PY2:
self.assertEqual(response.unmask_order(), ['choice_0', 'choice_aaa', 'choice_1', 'choice_ddd'])
else:
self.assertEqual(response.unmask_order(), ['choice_1', 'choice_aaa', 'choice_0', 'choice_ddd'])
def test_shuffle_different_seed(self):
xml_str = textwrap.dedent("""