summaryrefslogtreecommitdiffstats
path: root/ipatests/test_ipapython
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-09-18 15:28:23 +0200
committerJan Cholasta <jcholast@redhat.com>2015-10-07 10:27:20 +0200
commited96f8d9ba399d2c6909806692321d638b11ba8b (patch)
tree4c4175d101efea17aeedea847f43b1305e4ba95d /ipatests/test_ipapython
parentc9ca8de7a25af063a50d6735bec6a5181e96d758 (diff)
downloadfreeipa-ed96f8d9ba399d2c6909806692321d638b11ba8b.tar.gz
freeipa-ed96f8d9ba399d2c6909806692321d638b11ba8b.tar.xz
freeipa-ed96f8d9ba399d2c6909806692321d638b11ba8b.zip
ipapython.dn: Use rich comparisons
__cmp__ and cmp were removed from Python 3. Reviewed-By: David Kupka <dkupka@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipatests/test_ipapython')
-rw-r--r--ipatests/test_ipapython/test_dn.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/ipatests/test_ipapython/test_dn.py b/ipatests/test_ipapython/test_dn.py
index 14aaeafb5..0c5a37db5 100644
--- a/ipatests/test_ipapython/test_dn.py
+++ b/ipatests/test_ipapython/test_dn.py
@@ -4,11 +4,33 @@ import unittest
import six
-from ipapython.dn import *
+from ipapython.dn import DN, RDN, AVA
if six.PY3:
unicode = str
+ def cmp(a, b):
+ if a == b:
+ assert not a < b
+ assert not a > b
+ assert not a != b
+ assert a <= b
+ assert a >= b
+ return 0
+ elif a < b:
+ assert not a > b
+ assert a != b
+ assert a <= b
+ assert not a >= b
+ return -1
+ else:
+ assert a > b
+ assert a != b
+ assert not a <= b
+ assert a >= b
+ return 1
+
+
def expected_class(klass, component):
if klass is AVA:
if component == 'self':