Commit 5e103a91 by John Eskew

Fix pylint errors to get below limit.

parent 831dd593
...@@ -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) prg1 = Progress(0, 2) # pylint: disable=W0612
p = Progress(1, 2) prg2 = Progress(1, 2) # pylint: disable=W0612
p = Progress(2, 2) prg3 = Progress(2, 2) # pylint: disable=W0612
p = Progress(2.5, 5.0) prg4 = Progress(2.5, 5.0) # pylint: disable=W0612
p = Progress(3.7, 12.3333) prg5 = 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) prg = 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 prg in (self.not_started, self.half_done, self.done):
self.assertEqual(f(p), str(p)) self.assertEqual(f(prg), 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) prg1 = Progress(0, 2)
p2 = Progress(1, 3) prg2 = Progress(1, 3)
p3 = Progress(2, 5) prg3 = Progress(2, 5)
pNone = None prg_none = 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(prg1, prg1), (0, 4))
self.assertEqual(add(p, p2), (1, 5)) self.assertEqual(add(prg1, prg2), (1, 5))
self.assertEqual(add(p2, p3), (3, 8)) self.assertEqual(add(prg2, prg3), (3, 8))
self.assertEqual(add(p2, pNone), p2.frac()) self.assertEqual(add(prg2, prg_none), prg2.frac())
self.assertEqual(add(pNone, p2), p2.frac()) self.assertEqual(add(prg_none, prg2), prg2.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) prg1 = Progress(1, 2)
p2 = Progress(2, 4) prg2 = Progress(2, 4)
p3 = Progress(1, 2) prg3 = Progress(1, 2)
self.assertTrue(p == p3) self.assertTrue(prg1 == prg3)
self.assertFalse(p == p2) self.assertFalse(prg1 == prg2)
# Check != while we're at it # Check != while we're at it
self.assertTrue(p != p2) self.assertTrue(prg1 != prg2)
self.assertFalse(p != p3) self.assertFalse(prg1 != prg3)
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()) xmod = x_module.XModule(Mock(), get_test_system(), DictFieldData({'location': 'a://b/c/d/e'}), Mock())
p = xm.get_progress() prg = xmod.get_progress()
self.assertEqual(p, None) self.assertEqual(prg, None)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment