Exemple #1
0
def create_and_populate_indexer(factory, descriptions):

  indexer = altloc.Indexer( factory = factory )
  inserter = altloc.Inserter( indexer = indexer )

  for d in descriptions:
    d.accept( processor = inserter )

  return indexer
Exemple #2
0
    def setUp(self):

        self.regular = [object(), object(), object()]
        self.altloc_a = [object(), object(), object(), object()]
        self.altloc_b = [object(), object()]
        indexer = altloc.Indexer(factory=FakeIndexer2)
        indexer.regular.add_to(objects=self.regular)
        indexer.add(altloc="A")
        indexer.altlocs["A"].add_to(objects=self.altloc_a)
        indexer.add(altloc="B")
        indexer.altlocs["B"].add_to(objects=self.altloc_b)
        self.aggregator = altloc.Aggregator(indexer=indexer)
Exemple #3
0
    def test_1(self):

        factory = lambda: object()

        indexer = altloc.Indexer(factory=factory)
        self.assertTrue(isinstance(indexer.regular, object))
        self.assertEqual(indexer.factory, factory)
        self.assertEqual(indexer.altlocs, {})

        altid = object()
        indexer.add(altloc=altid)
        self.assertTrue(altid in indexer.altlocs)
        self.assertTrue(isinstance(indexer.altlocs[altid], object))
Exemple #4
0
    def setUp(self):

        self.inserter = altloc.Inserter(indexer=altloc.Indexer(
            factory=FakeIndexer))