summaryrefslogtreecommitdiff
path: root/keystoneclient/tests/unit/test_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'keystoneclient/tests/unit/test_base.py')
-rw-r--r--keystoneclient/tests/unit/test_base.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/keystoneclient/tests/unit/test_base.py b/keystoneclient/tests/unit/test_base.py
index 7a43619..9814d3d 100644
--- a/keystoneclient/tests/unit/test_base.py
+++ b/keystoneclient/tests/unit/test_base.py
@@ -58,25 +58,37 @@ class BaseTest(utils.TestCase):
r1 = base.Resource(None, {'id': 1, 'name': 'hi'})
r2 = base.Resource(None, {'id': 1, 'name': 'hello'})
self.assertNotEqual(r1, r2)
+ self.assertTrue(r1 != r2)
# Two resources with same ID: equal if their info is equal
+ # The truth of r1==r2 does not imply that r1!=r2 is false in PY2.
+ # Test that inequality operator is defined and that comparing equal
+ # items returns False
r1 = base.Resource(None, {'id': 1, 'name': 'hello'})
r2 = base.Resource(None, {'id': 1, 'name': 'hello'})
- self.assertEqual(r1, r2)
+ self.assertTrue(r1 == r2)
+ self.assertFalse(r1 != r2)
- # Two resoruces of different types: never equal
+ # Two resources of different types: never equal
r1 = base.Resource(None, {'id': 1})
r2 = roles.Role(None, {'id': 1})
self.assertNotEqual(r1, r2)
+ self.assertTrue(r1 != r2)
# Two resources with no ID: equal if their info is equal
+ # The truth of r1==r2 does not imply that r1!=r2 is false in PY2.
+ # Test that inequality operator is defined and that comparing equal
+ # items returns False.
r1 = base.Resource(None, {'name': 'joe', 'age': 12})
r2 = base.Resource(None, {'name': 'joe', 'age': 12})
- self.assertEqual(r1, r2)
+ self.assertTrue(r1 == r2)
+ self.assertFalse(r1 != r2)
r1 = base.Resource(None, {'id': 1})
self.assertNotEqual(r1, object())
+ self.assertTrue(r1 != object())
self.assertNotEqual(r1, {'id': 1})
+ self.assertTrue(r1 != {'id': 1})
def test_human_id(self):
r = base.Resource(None, {"name": "1 of !"})