def test_get_ancestors(self):
        bs_data = {
           'pm_property_id': 1243,
           'tax_lot_id': '435/422',
           'property_name': 'Greenfield Complex',
           'custom_id_1': 1243,
           'address_line_1': '555 Database LN.',
           'address_line_2': '',
           'city': 'Gotham City',
           'postal_code': 8999,
        }

        # Setup mapped AS snapshot.
        snapshot = util.make_fake_snapshot(
            self.import_file, bs_data, ASSESSED_BS, is_canon=True,
            org=self.fake_org
        )
        # Different file, but same ImportRecord.
        # Setup mapped PM snapshot.
        # Should be an identical match.
        new_import_file = ImportFile.objects.create(
            import_record=self.import_record,
            raw_save_done=True,
            mapping_done=True
        )

        new_snapshot = util.make_fake_snapshot(
            new_import_file, bs_data, PORTFOLIO_BS, org=self.fake_org
        )

        tasks.match_buildings(new_import_file.pk, self.fake_user.pk)

        result = BuildingSnapshot.objects.filter(source_type=4)[0]
        ancestor_pks = set([b.pk for b in get_ancestors(result)])
        buildings = BuildingSnapshot.objects.filter(
            source_type__in=[2, 3]
        ).exclude(
            pk=result.pk
        )
        building_pks = set([b.pk for b in buildings])

        self.assertEqual(ancestor_pks, building_pks)
Tests get_ancestors(building), returns all non-composite, non-raw
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/tests/test_tasks.py/TestTasks.test_get_ancestors