

def test_generate_instance_from_schema(self, _, __):
    'Only questions that are in the main table and of the same version should be shown'
    build_ids_and_versions = {
        self.app_id: 3,
    }
    with mock.patch('corehq.apps.export.models.new.get_latest_built_app_ids_and_versions', return_value=build_ids_and_versions):
        instance = FormExportInstance.generate_instance_from_schema(self.schema)
    self.assertEqual(len(instance.tables), 2)
    (index, split_column) = instance.tables[0].get_column([PathNode(name='data'), PathNode(name='question1')], 'MultipleChoiceItem', None)
    self.assertTrue(isinstance(split_column, SplitExportColumn))
    selected = filter((lambda column: column.selected), (instance.tables[0].columns + instance.tables[1].columns))
    shown = filter((lambda column: column.selected), (instance.tables[0].columns + instance.tables[1].columns))
    selected_system_props = len([x for x in MAIN_FORM_TABLE_PROPERTIES if index.selected])
    self.assertEqual(len(selected), (1 + selected_system_props))
    self.assertEqual(len(shown), (1 + selected_system_props))

dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/export/tests/test_export_instance.py TestExportInstanceGeneration.test_generate_instance_from_schema/VarMisuse@196/309 `x`->`index`