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
5e103a91
Commit
5e103a91
authored
Oct 15, 2014
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pylint errors to get below limit.
parent
831dd593
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
30 deletions
+30
-30
common/lib/xmodule/xmodule/tests/test_progress.py
+30
-30
No files found.
common/lib/xmodule/xmodule/tests/test_progress.py
View file @
5e103a91
...
@@ -23,12 +23,12 @@ class ProgressTest(unittest.TestCase):
...
@@ -23,12 +23,12 @@ class ProgressTest(unittest.TestCase):
def
test_create_object
(
self
):
def
test_create_object
(
self
):
# These should work:
# These should work:
p
=
Progress
(
0
,
2
)
p
rg1
=
Progress
(
0
,
2
)
# pylint: disable=W0612
p
=
Progress
(
1
,
2
)
p
rg2
=
Progress
(
1
,
2
)
# pylint: disable=W0612
p
=
Progress
(
2
,
2
)
p
rg3
=
Progress
(
2
,
2
)
# pylint: disable=W0612
p
=
Progress
(
2.5
,
5.0
)
p
rg4
=
Progress
(
2.5
,
5.0
)
# pylint: disable=W0612
p
=
Progress
(
3.7
,
12.3333
)
p
rg5
=
Progress
(
3.7
,
12.3333
)
# pylint: disable=W0612
# These shouldn't
# These shouldn't
self
.
assertRaises
(
ValueError
,
Progress
,
0
,
0
)
self
.
assertRaises
(
ValueError
,
Progress
,
0
,
0
)
...
@@ -44,10 +44,10 @@ class ProgressTest(unittest.TestCase):
...
@@ -44,10 +44,10 @@ class ProgressTest(unittest.TestCase):
self
.
assertEqual
((
0
,
2
),
Progress
(
-
2
,
2
)
.
frac
())
self
.
assertEqual
((
0
,
2
),
Progress
(
-
2
,
2
)
.
frac
())
def
test_frac
(
self
):
def
test_frac
(
self
):
p
=
Progress
(
1
,
2
)
p
rg
=
Progress
(
1
,
2
)
(
a
,
b
)
=
p
.
frac
()
(
a
_mem
,
b_mem
)
=
prg
.
frac
()
self
.
assertEqual
(
a
,
1
)
self
.
assertEqual
(
a
_mem
,
1
)
self
.
assertEqual
(
b
,
2
)
self
.
assertEqual
(
b
_mem
,
2
)
def
test_percent
(
self
):
def
test_percent
(
self
):
self
.
assertEqual
(
self
.
not_started
.
percent
(),
0
)
self
.
assertEqual
(
self
.
not_started
.
percent
(),
0
)
...
@@ -98,38 +98,38 @@ class ProgressTest(unittest.TestCase):
...
@@ -98,38 +98,38 @@ class ProgressTest(unittest.TestCase):
def
test_to_js_detail_str
(
self
):
def
test_to_js_detail_str
(
self
):
'''Test the Progress.to_js_detail_str() method'''
'''Test the Progress.to_js_detail_str() method'''
f
=
Progress
.
to_js_detail_str
f
=
Progress
.
to_js_detail_str
for
p
in
(
self
.
not_started
,
self
.
half_done
,
self
.
done
):
for
p
rg
in
(
self
.
not_started
,
self
.
half_done
,
self
.
done
):
self
.
assertEqual
(
f
(
p
),
str
(
p
))
self
.
assertEqual
(
f
(
p
rg
),
str
(
prg
))
# But None should be encoded as 0
# But None should be encoded as 0
self
.
assertEqual
(
f
(
None
),
"0"
)
self
.
assertEqual
(
f
(
None
),
"0"
)
def
test_add
(
self
):
def
test_add
(
self
):
'''Test the Progress.add_counts() method'''
'''Test the Progress.add_counts() method'''
p
=
Progress
(
0
,
2
)
p
rg1
=
Progress
(
0
,
2
)
p2
=
Progress
(
1
,
3
)
p
rg
2
=
Progress
(
1
,
3
)
p3
=
Progress
(
2
,
5
)
p
rg
3
=
Progress
(
2
,
5
)
p
N
one
=
None
p
rg_n
one
=
None
add
=
lambda
a
,
b
:
Progress
.
add_counts
(
a
,
b
)
.
frac
()
add
=
lambda
a
,
b
:
Progress
.
add_counts
(
a
,
b
)
.
frac
()
self
.
assertEqual
(
add
(
p
,
p
),
(
0
,
4
))
self
.
assertEqual
(
add
(
p
rg1
,
prg1
),
(
0
,
4
))
self
.
assertEqual
(
add
(
p
,
p
2
),
(
1
,
5
))
self
.
assertEqual
(
add
(
p
rg1
,
prg
2
),
(
1
,
5
))
self
.
assertEqual
(
add
(
p
2
,
p
3
),
(
3
,
8
))
self
.
assertEqual
(
add
(
p
rg2
,
prg
3
),
(
3
,
8
))
self
.
assertEqual
(
add
(
p
2
,
pNone
),
p
2
.
frac
())
self
.
assertEqual
(
add
(
p
rg2
,
prg_none
),
prg
2
.
frac
())
self
.
assertEqual
(
add
(
p
None
,
p2
),
p
2
.
frac
())
self
.
assertEqual
(
add
(
p
rg_none
,
prg2
),
prg
2
.
frac
())
def
test_equality
(
self
):
def
test_equality
(
self
):
'''Test that comparing Progress objects for equality
'''Test that comparing Progress objects for equality
works correctly.'''
works correctly.'''
p
=
Progress
(
1
,
2
)
p
rg1
=
Progress
(
1
,
2
)
p2
=
Progress
(
2
,
4
)
p
rg
2
=
Progress
(
2
,
4
)
p3
=
Progress
(
1
,
2
)
p
rg
3
=
Progress
(
1
,
2
)
self
.
assertTrue
(
p
==
p
3
)
self
.
assertTrue
(
p
rg1
==
prg
3
)
self
.
assertFalse
(
p
==
p
2
)
self
.
assertFalse
(
p
rg1
==
prg
2
)
# Check != while we're at it
# Check != while we're at it
self
.
assertTrue
(
p
!=
p
2
)
self
.
assertTrue
(
p
rg1
!=
prg
2
)
self
.
assertFalse
(
p
!=
p
3
)
self
.
assertFalse
(
p
rg1
!=
prg
3
)
class
ModuleProgressTest
(
unittest
.
TestCase
):
class
ModuleProgressTest
(
unittest
.
TestCase
):
...
@@ -137,6 +137,6 @@ class ModuleProgressTest(unittest.TestCase):
...
@@ -137,6 +137,6 @@ class ModuleProgressTest(unittest.TestCase):
'''
'''
def
test_xmodule_default
(
self
):
def
test_xmodule_default
(
self
):
'''Make sure default get_progress exists, returns None'''
'''Make sure default get_progress exists, returns None'''
xm
=
x_module
.
XModule
(
Mock
(),
get_test_system
(),
DictFieldData
({
'location'
:
'a://b/c/d/e'
}),
Mock
())
xm
od
=
x_module
.
XModule
(
Mock
(),
get_test_system
(),
DictFieldData
({
'location'
:
'a://b/c/d/e'
}),
Mock
())
p
=
xm
.
get_progress
()
p
rg
=
xmod
.
get_progress
()
self
.
assertEqual
(
p
,
None
)
self
.
assertEqual
(
p
rg
,
None
)
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