diff options
author | Alessio Sergi <al3hex@gmail.com> | 2015-11-06 22:33:11 +0100 |
---|---|---|
committer | Alessio Sergi <al3hex@gmail.com> | 2015-11-06 22:33:11 +0100 |
commit | 25816ceae7799eafda2b23dd8cc872f309e876a0 (patch) | |
tree | 5f3bb35b456ca7b35bf0221690ba297279d92788 /unitest.py | |
parent | 4426487e63bb10dbdbfd6f9cd51412fd2994b493 (diff) |
Percentage bars: non-blocking solution for values out of range
Diffstat (limited to 'unitest.py')
-rwxr-xr-x | unitest.py | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -179,17 +179,25 @@ class TestGlances(unittest.TestCase): # self.assertEqual(total, len(stats_grab)) def test_011_output_bars_must_be_between_0_and_100_percent(self): - """Test quick look plugin.""" + """Test quick look plugin. + + > bar.min_value + 0 + > bar.max_value + 100 + > bar.percent = -1 + > bar.percent + 0 + > bar.percent = 101 + > bar.percent + 100 + """ print('INFO: [TEST_011] Test progress bar') bar = Bar(size=1) - with self.assertRaises(AssertionError): - bar.percent = -1 - bar.percent = 101 - - # 0 - 100 is an inclusive range, so these should not error. - bar.percent = 0 - bar.percent = 100 - + bar.percent = -1 + self.assertLessEqual(bar.percent, bar.min_value) + bar.percent = 101 + self.assertGreaterEqual(bar.percent, bar.max_value) if __name__ == '__main__': unittest.main() |