def testForeignKey(self):
        session = yield self.data.makePositions(self)
        query = session.query(Position).load_related('instrument').load_related('fund')
        #
        positions = yield query.all()
        self.assertTrue(positions)
        #
        multi = []
        for p in positions:
            self.assertTrue(isinstance(p.instrument, Instrument))
            self.assertTrue(isinstance(p.fund, Fund))
            multi.append(query.filter(instrument=p.instrument, fund=p.fund).all())
        multi = yield self.multi_async(multi)
        for p, pos in zip(positions, multi):
            self.assertTrue(p in pos)
        #
        # Testing
        total_positions = len(positions)
        totp = 0
        multi = []
        instruments = yield session.query(Instrument).all()
        #
        for instrument in instruments:
            multi.append(instrument.positions.query().load_related('instrument').all())
        multi = yield self.multi_async(multi)
        #
        for instrument, pos in zip(instruments, multi):
            for p in pos:
                self.assertTrue(isinstance(p, Position))
                self.assertEqual(p.instrument, instrument)
            totp += len(pos)
        #
        self.assertEqual(total_positions, totp)
Get all the contiguity overrides from the XML data.
dataset/ETHPy150Open lsbardel/python-stdnet/tests/all/topics/finance.py/TestFinanceApplication.testForeignKey--crossover with--dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/__init__.py/StoredConfig.filter_contiguity_overrides