summaryrefslogtreecommitdiffstats
path: root/unitest.py
diff options
context:
space:
mode:
authorAlessio Sergi <al3hex@gmail.com>2018-01-29 19:19:19 +0100
committerAlessio Sergi <al3hex@gmail.com>2018-01-29 19:19:19 +0100
commit32425eb205eb7ad83b838a020423b0fda80fb8e2 (patch)
tree443f5c3e2715dbe144c05f30ed1f0b4447aa4988 /unitest.py
parent7a0b9bcbc9f07221ffe6889ebacc31674958674c (diff)
Implement rich comparisons rather than relying on __cmp__()
The __cmp__() special method is gone in Python 3 in favor of rich comparison methods.
Diffstat (limited to 'unitest.py')
-rwxr-xr-xunitest.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/unitest.py b/unitest.py
index 015bc46b..3ea2170a 100755
--- a/unitest.py
+++ b/unitest.py
@@ -28,7 +28,7 @@ from glances.stats import GlancesStats
from glances import __version__
from glances.globals import WINDOWS, LINUX
from glances.outputs.glances_bars import Bar
-from glances.compat import PY3, PY_PYPY
+from glances.compat import PY_PYPY
from glances.thresholds import GlancesThresholdOk
from glances.thresholds import GlancesThresholdCareful
from glances.thresholds import GlancesThresholdWarning
@@ -213,7 +213,6 @@ class TestGlances(unittest.TestCase):
self.assertTrue(type(stats_grab) is list, msg='GPU stats is not a list')
print('INFO: GPU stats: %s' % stats_grab)
- @unittest.skipIf(PY3, True)
@unittest.skipIf(PY_PYPY, True)
def test_094_thresholds(self):
"""Test thresholds classes"""
@@ -226,11 +225,11 @@ class TestGlances(unittest.TestCase):
self.assertTrue(careful < warning)
self.assertTrue(warning < critical)
self.assertFalse(ok > careful)
- self.assertTrue(ok == ok)
- self.assertTrue(str(ok) == 'OK')
+ self.assertEqual(ok, ok)
+ self.assertEqual(str(ok), 'OK')
thresholds = GlancesThresholds()
thresholds.add('cpu_percent', 'OK')
- self.assertTrue(thresholds.get(stat_name='cpu_percent').description() == 'OK')
+ self.assertEqual(thresholds.get(stat_name='cpu_percent').description(), 'OK')
def test_095_methods(self):
"""Test mandatories methods"""