old_contents: from disco.test import DiscoJobTestFixture, DiscoTestCase
  
  class FiveTestCase(DiscoJobTestFixture, DiscoTestCase):
      inputs = [''] * int(5)
      sort   = False
  
      def getdata(self, path):
          return "Gutta cavat cavat capidem\n" * 100
  
      @property
      def partitions(self):
          return min(self.num_workers * 10, 300)
  
      @staticmethod
      def map(line, params):
          for word in line.lower().split():
              yield word, 1
  
      @staticmethod
      def reduce(iter, out, params):
          from itertools import groupby
          for k, kvs in groupby(sorted(iter), lambda kv: kv[0]):
              out.add(k, sum(int(v) for k, v in kvs))
  
      def runTest(self):
          self.assertEquals(dict(self.results),
                    {'gutta':   int(5e2),
                     'cavat':   int(1e3),
                     'capidem': int(5e2)})
  
  class FiftyThousandTestCase(FiveTestCase):
      inputs = [''] * int(5e4)
  
      def runTest(self):
          self.assertEquals(dict(self.results),
                    {'gutta':   int(5e6),
                     'cavat':   int(1e7),
                     'capidem': int(5e6)})
  
new_contents: from disco.test import TestCase, TestJob
  from disco.util import kvgroup
  
  class ManyMapJob(TestJob):
      sort = False
  
      @staticmethod
      def map(line, params):
          for word in line.lower().split():
              yield word, 1
  
      @staticmethod
      def reduce(iter, params):
          for k, vs in kvgroup(sorted(iter)):
              yield k, sum(int(v) for v in vs)
  
  class ManyMapTestCase(TestCase):
      @property
      def partitions(self):
          return min(self.num_workers * 10, 300)
  
      def serve(self, path):
          return "Gutta cavat cavat lapidem\n" * 100
  
      def test_five(self):
          self.job = ManyMapJob().run(input=self.test_server.urls([''] * 5),
                                      partitions=self.partitions)
          self.assertEquals(dict(self.results(self.job)),
                            {'gutta':   int(5e2),
                             'cavat':   int(1e3),
                             'lapidem': int(5e2)})
  
      def test_50k(self):
          self.job = ManyMapJob().run(input=self.test_server.urls([''] * int(5e4)),
                                      partitions=self.partitions)
          self.assertEquals(dict(self.results(self.job)),
                            {'gutta':   int(5e6),
                             'cavat':   int(1e7),
                             'lapidem': int(5e6)})
  
subject: convert test_50k