From 7b4ad69b59e8951b90545dd02befa579e90f8582 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 11 Mar 2016 10:39:13 +0100 Subject: s4:dsdb/test/sort: avoid 'from collections import Counter' This is only available in python 2.7 and >= 3.1 This should fix make test with python 2.6. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- source4/dsdb/tests/python/sort.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source4/dsdb/tests/python/sort.py') diff --git a/source4/dsdb/tests/python/sort.py b/source4/dsdb/tests/python/sort.py index c4d2c445268..b7b9d836e8f 100644 --- a/source4/dsdb/tests/python/sort.py +++ b/source4/dsdb/tests/python/sort.py @@ -5,7 +5,6 @@ from unicodedata import normalize import locale locale.setlocale(locale.LC_ALL, ('en_US', 'UTF-8')) -from collections import Counter import optparse import sys import os @@ -191,7 +190,13 @@ class BaseSortTests(samba.tests.TestCase): self.expected_results[k] = (fixed, list(reversed(fixed))) for k in ('streetAddress', 'postalAddress'): if k in self.expected_results: - c = Counter([u[k] for u in self.users]) + c = {} + for u in self.users: + x = u[k] + if x in c: + c[x] += 1 + continue + c[x] = 1 fixed = [] for x in FIENDISH_TESTS: fixed += [norm(x)] * c[x] -- cgit v1.2.3