sys.path.insert(0, "bin/python")
import samba
from samba.tests.subunitrun import SubunitOptions, TestProgram
-from samba.compat import cmp_fn
-from samba.compat import cmp_to_key_fn
+from samba.common import cmp
+from functools import cmp_to_key
import samba.getopt as options
from samba.auth import system_session
return locale.strcoll(a[0], b[0])
def cmp_binary(a, b):
- return cmp_fn(a[0], b[0])
+ return cmp(a[0], b[0])
def cmp_numeric(a, b):
- return cmp_fn(int(a[0]), int(b[0]))
+ return cmp(int(a[0]), int(b[0]))
# For testing simplicity, the attributes in here need to be
# unique for each user. Otherwise there are multiple possible
for sort_attr, result_attr in attr_pairs:
forward = sorted(((norm(x[sort_attr]), norm(x[result_attr]))
for x in self.users),
- key=cmp_to_key_fn(sort_functions[sort_attr]))
+ key=cmp_to_key(sort_functions[sort_attr]))
reverse = list(reversed(forward))
for rev in (0, 1):