From 7a2aaa09c1ea07120d5ae7623a3da4723012808f Mon Sep 17 00:00:00 2001 From: jinder1s Date: Thu, 26 Sep 2019 08:47:18 -0400 Subject: [PATCH] random.shuffle compatibility fix between python 2.7 and 3.5 --- common/lib/capa/capa/tests/test_shuffle.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/lib/capa/capa/tests/test_shuffle.py b/common/lib/capa/capa/tests/test_shuffle.py index 11f8445b42..42109642ca 100644 --- a/common/lib/capa/capa/tests/test_shuffle.py +++ b/common/lib/capa/capa/tests/test_shuffle.py @@ -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("""