-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_pod_states.py
More file actions
33 lines (26 loc) · 1.18 KB
/
test_pod_states.py
File metadata and controls
33 lines (26 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import unittest
from scheduler.states import PodState
class TestSchedulerStates(unittest.TestCase):
"""Test Scheduler States OrderedEnum"""
def test_gt_comparison(self):
self.assertTrue(PodState.up > PodState.starting)
self.assertFalse(PodState.starting > PodState.up)
with self.assertRaises(TypeError):
self.assertTrue(PodState.up > 'starting')
def test_ge_comparison(self):
self.assertTrue(PodState.up >= PodState.starting)
self.assertFalse(PodState.starting >= PodState.up)
with self.assertRaises(TypeError):
self.assertTrue(PodState.up >= 'starting')
def test_lt_comparison(self):
self.assertFalse(PodState.up < PodState.starting)
self.assertTrue(PodState.starting < PodState.up)
with self.assertRaises(TypeError):
self.assertTrue(PodState.up < 'crashed')
def test_le_comparison(self):
self.assertFalse(PodState.up <= PodState.starting)
self.assertTrue(PodState.starting <= PodState.up)
with self.assertRaises(TypeError):
self.assertTrue(PodState.up <= 'crashed')
def test_str(self):
self.assertEqual(str(PodState.up), 'up')