Ticket #6137: 6137_introom.patch

File 6137_introom.patch, 1.5 KB (added by eddie, 9 years ago)
  • twisted/python/test/test_dist.py

     
    88
    99import os
    1010import sys
    11 from collections import Counter
     11from collections import defaultdict
    1212
    1313from distutils.core import Distribution
    1414
     
    275275
    276276        scriptsReturned = dist.getAllScripts()
    277277
     278        # This helper function provides the similiar functionality
     279        # as provided by collections.Counter
     280        def getCount(input):
     281            ret = defaultdict(int)
     282            for k in input:
     283                ret[k] += 1
     284            return ret
     285
     286
    278287        # getAllScripts should call getScripts once on each directory which
    279288        # corresponds to a subproject, and also on the current directory (for
    280289        # the core subproject). It may do this in any order.
    281         self.assertEqual(Counter(directoriesQueried),
    282                          Counter(dummySubprojects + ['']))
     290        self.assertEqual(getCount(directoriesQueried),
     291                         getCount(dummySubprojects + ['']))
    283292        # getAllScripts should collect all the scripts returned by getScripts,
    284293        # in any order.
    285         self.assertEqual(Counter(scriptsReturned),
    286                          Counter(scriptsGiven))
     294        self.assertEqual(getCount(scriptsReturned),
     295                         getCount(scriptsGiven))
    287296
    288297
    289298