summaryrefslogtreecommitdiffstats
path: root/unitest.py
diff options
context:
space:
mode:
authorAlessio Sergi <al3hex@gmail.com>2015-11-06 22:33:11 +0100
committerAlessio Sergi <al3hex@gmail.com>2015-11-06 22:33:11 +0100
commit25816ceae7799eafda2b23dd8cc872f309e876a0 (patch)
tree5f3bb35b456ca7b35bf0221690ba297279d92788 /unitest.py
parent4426487e63bb10dbdbfd6f9cd51412fd2994b493 (diff)
Percentage bars: non-blocking solution for values out of range
Diffstat (limited to 'unitest.py')
-rwxr-xr-xunitest.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/unitest.py b/unitest.py
index e4fdc985..94efddf3 100755
--- a/unitest.py
+++ b/unitest.py
@@ -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()