Commit 9b5fb7f7 by Calen Pennington

Test that values are clamped between 0 and 100% for progresses

parent b28317ed
......@@ -704,13 +704,15 @@ class ProgressTest(unittest.TestCase):
self.assertRaises(ValueError, Progress, 0, 0)
self.assertRaises(ValueError, Progress, 2, 0)
self.assertRaises(ValueError, Progress, 1, -2)
self.assertRaises(ValueError, Progress, 3, 2)
self.assertRaises(ValueError, Progress, -2, 5)
self.assertRaises(TypeError, Progress, 0, "all")
# check complex numbers just for the heck of it :)
self.assertRaises(TypeError, Progress, 2j, 3)
def test_clamp(self):
self.assertEqual((2, 2), Progress(3, 2).frac())
self.assertEqual((-2, 2), Progress(0, 2).frac())
def test_frac(self):
p = Progress(1, 2)
(a, b) = p.frac()
......
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