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
ae7eb2f7
Commit
ae7eb2f7
authored
Nov 11, 2014
by
stv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove orphaned code
parent
056faa18
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
105 deletions
+0
-105
lms/djangoapps/courseware/progress.py
+0
-38
lms/djangoapps/courseware/tests/test_progress.py
+0
-67
No files found.
lms/djangoapps/courseware/progress.py
deleted
100644 → 0
View file @
056faa18
class
completion
(
object
):
def
__init__
(
self
,
**
d
):
self
.
dict
=
dict
({
'duration_total'
:
0
,
'duration_watched'
:
0
,
'done'
:
True
,
'questions_correct'
:
0
,
'questions_incorrect'
:
0
,
'questions_total'
:
0
})
if
d
:
self
.
dict
.
update
(
d
)
def
__getitem__
(
self
,
key
):
return
self
.
dict
[
key
]
def
__setitem__
(
self
,
key
,
value
):
self
.
dict
[
key
]
=
value
def
__add__
(
self
,
other
):
result
=
dict
(
self
.
dict
)
for
item
in
[
'duration_total'
,
'duration_watched'
,
'done'
,
'questions_correct'
,
'questions_incorrect'
,
'questions_total'
]:
result
[
item
]
=
result
[
item
]
+
other
.
dict
[
item
]
return
completion
(
**
result
)
def
__contains__
(
self
,
key
):
return
key
in
dict
def
__repr__
(
self
):
return
repr
(
self
.
dict
)
if
__name__
==
'__main__'
:
dict1
=
completion
(
duration_total
=
5
)
dict2
=
completion
(
duration_total
=
7
)
print
dict1
+
dict2
lms/djangoapps/courseware/tests/test_progress.py
deleted
100644 → 0
View file @
056faa18
from
django.test
import
TestCase
from
courseware
import
progress
from
mock
import
MagicMock
class
ProgessTests
(
TestCase
):
def
setUp
(
self
):
self
.
d
=
dict
({
'duration_total'
:
0
,
'duration_watched'
:
0
,
'done'
:
True
,
'questions_correct'
:
4
,
'questions_incorrect'
:
0
,
'questions_total'
:
0
,
})
self
.
c
=
progress
.
completion
()
self
.
c2
=
progress
.
completion
()
self
.
c2
.
dict
=
dict
({
'duration_total'
:
0
,
'duration_watched'
:
0
,
'done'
:
True
,
'questions_correct'
:
2
,
'questions_incorrect'
:
1
,
'questions_total'
:
0
,
})
self
.
cplusc2
=
dict
({
'duration_total'
:
0
,
'duration_watched'
:
0
,
'done'
:
True
,
'questions_correct'
:
2
,
'questions_incorrect'
:
1
,
'questions_total'
:
0
,
})
self
.
oth
=
dict
({
'duration_total'
:
0
,
'duration_watched'
:
0
,
'done'
:
True
,
'questions_correct'
:
4
,
'questions_incorrect'
:
0
,
'questions_total'
:
7
,
})
self
.
x
=
MagicMock
()
self
.
x
.
dict
=
self
.
oth
self
.
d_oth
=
{
'duration_total'
:
0
,
'duration_watched'
:
0
,
'done'
:
True
,
'questions_correct'
:
4
,
'questions_incorrect'
:
0
,
'questions_total'
:
7
,
}
def
test_getitem
(
self
):
self
.
assertEqual
(
self
.
c
.
__getitem__
(
'duration_watched'
),
0
)
def
test_setitem
(
self
):
self
.
c
.
__setitem__
(
'questions_correct'
,
4
)
self
.
assertEqual
(
str
(
self
.
c
),
str
(
self
.
d
))
def
test_repr
(
self
):
self
.
assertEqual
(
self
.
c
.
__repr__
(),
str
(
progress
.
completion
()))
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