Debian Codegraph @

test/units/playbook/test_attribute.py

raw
1 # (c) 2015, Marius Gedminas <[email protected]>
2 #
3 # This file is part of Ansible
4 #
5 # Ansible is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Ansible is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
17
18 from __future__ import annotations
19
20 import unittest
21 from ansible.playbook.attribute import Attribute
22
23
24 class TestAttribute(unittest.TestCase):
25
26 def setUp(self):
27 self.one = Attribute(priority=100)
28 self.two = Attribute(priority=0)
29
30 def test_eq(self):
31 self.assertTrue(self.one == self.one)
32 self.assertFalse(self.one == self.two)
33
34 def test_ne(self):
35 self.assertFalse(self.one != self.one)
36 self.assertTrue(self.one != self.two)
37
38 def test_lt(self):
39 self.assertFalse(self.one < self.one)
40 self.assertTrue(self.one < self.two)
41 self.assertFalse(self.two < self.one)
42
43 def test_gt(self):
44 self.assertFalse(self.one > self.one)
45 self.assertFalse(self.one > self.two)
46 self.assertTrue(self.two > self.one)
47
48 def test_le(self):
49 self.assertTrue(self.one <= self.one)
50 self.assertTrue(self.one <= self.two)
51 self.assertFalse(self.two <= self.one)
52
53 def test_ge(self):
54 self.assertTrue(self.one >= self.one)
55 self.assertFalse(self.one >= self.two)
56 self.assertTrue(self.two >= self.one)