diff options
author | kevinlondon <kevinlondon@gmail.com> | 2015-09-20 12:44:59 -0700 |
---|---|---|
committer | Alessio Sergi <al3hex@gmail.com> | 2015-09-21 00:59:20 +0200 |
commit | 2b1b80c0323f89baabc7b71fcb7db549be9cddfc (patch) | |
tree | 9a7632e6c348ba5a4c702778c2aa50c0118a3a81 /unitest.py | |
parent | b75d921ff01311780cb1b54c0151ac1b18c0c603 (diff) |
Changed percentage bars to use an explicit assertion error if valid is outside of the expected range.
Diffstat (limited to 'unitest.py')
-rwxr-xr-x | unitest.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -24,6 +24,7 @@ import sys import time import unittest +from glances.outputs.glances_bars import Bar from glances.core.glances_globals import ( appname, is_linux, @@ -186,5 +187,16 @@ class TestGlances(unittest.TestCase): # Check if number of processes in the list equal counter # self.assertEqual(total, len(stats_grab)) + def test_011_output_bars_must_be_between_0_and_100_percent(self): + 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 + + if __name__ == '__main__': unittest.main() |