1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

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 <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher
2016-03-11 10:39:13 +01:00
committed by Andrew Bartlett
parent 1a315bec27
commit 7b4ad69b59

View File

@ -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]