Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6e5c8610
Commit
6e5c8610
authored
Jun 26, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #272 from edx/fix/LMS-500
Fix LMS-500: Random class in random module was None
parents
c41c102b
ed62c5a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
+18
-1
common/lib/capa/capa/safe_exec/safe_exec.py
+0
-1
common/lib/capa/capa/tests/test_responsetypes.py
+18
-0
No files found.
common/lib/capa/capa/safe_exec/safe_exec.py
View file @
6e5c8610
...
...
@@ -18,7 +18,6 @@ import random as random_module
import sys
random = random_module.Random(
%
r)
random.Random = random_module.Random
del random_module
sys.modules['random'] = random
"""
...
...
common/lib/capa/capa/tests/test_responsetypes.py
View file @
6e5c8610
...
...
@@ -1266,6 +1266,24 @@ class CustomResponseTest(ResponseTest):
msg
=
correct_map
.
get_msg
(
'1_2_1'
)
self
.
assertEqual
(
msg
,
self
.
_get_random_number_result
(
problem
.
seed
))
def
test_random_isnt_none
(
self
):
# Bug LMS-500 says random.seed(10) fails with:
# File "<string>", line 61, in <module>
# File "/usr/lib/python2.7/random.py", line 116, in seed
# super(Random, self).seed(a)
# TypeError: must be type, not None
r
=
random
.
Random
()
r
.
seed
(
10
)
num
=
r
.
randint
(
0
,
1e9
)
script
=
textwrap
.
dedent
(
"""
random.seed(10)
num = random.randint(0, 1e9)
"""
)
problem
=
self
.
build_problem
(
script
=
script
)
self
.
assertEqual
(
problem
.
context
[
'num'
],
num
)
def
test_module_imports_inline
(
self
):
'''
Check that the correct modules are available to custom
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment