def test_get_questions_by_ids(self): question = question_domain.Question( 'dummy', self._create_valid_question_data('ABC'), 1, 'en') question1_id = question_services.add_question(self.owner_id, question) question = question_domain.Question( 'dummy2', self._create_valid_question_data('ABC'), 1, 'en') question2_id = question_services.add_question(self.owner_id, question) questions = question_services.get_questions_by_ids( [question1_id, question2_id]) self.assertEqual(len(questions), 2) self.assertEqual(questions[0].question_id, question1_id) self.assertEqual(questions[1].question_id, question2_id)
def test_update_question(self): state = exp_domain.State.create_default_state('ABC') question_data = state.to_dict() question_id = 'dummy' title = 'A Question' question_data_schema_version = 1 collection_id = 'col1' language_code = 'en' question = question_domain.Question(question_id, title, question_data, question_data_schema_version, collection_id, language_code) question_id = question_services.add_question(self.owner_id, question) change_dict = { 'cmd': 'update_question_property', 'property_name': 'title', 'new_value': 'ABC', 'old_value': 'A Question' } change_list = [question_domain.QuestionChange(change_dict)] question_services.update_question(self.owner_id, question_id, change_list, 'updated title') model = question_models.QuestionModel.get(question_id) self.assertEqual(model.title, 'ABC') self.assertEqual(model.question_data, question_data) self.assertEqual(model.question_data_schema_version, question_data_schema_version) self.assertEqual(model.collection_id, collection_id) self.assertEqual(model.language_code, language_code)
def test_update_question(self): question_data = self._create_valid_question_data('ABC') question_id = 'dummy' question_data_schema_version = 1 language_code = 'en' question = question_domain.Question(question_id, question_data, question_data_schema_version, language_code) new_question_data = self._create_valid_question_data('DEF') question_id = question_services.add_question(self.owner_id, question) change_dict = { 'cmd': 'update_question_property', 'property_name': 'question_data', 'new_value': new_question_data, 'old_value': question_data } change_list = [question_domain.QuestionChange(change_dict)] question_services.update_question(self.owner_id, question_id, change_list, ('updated question data')) model = question_models.QuestionModel.get(question_id) self.assertEqual(model.question_data, new_question_data) self.assertEqual(model.question_data_schema_version, question_data_schema_version) self.assertEqual(model.language_code, language_code)
def test_get_questions_by_ids(self): question = question_domain.Question( 'dummy', 'A Question', exp_domain.State.create_default_state('ABC').to_dict(), 1, 'en') question1_id = question_services.add_question(self.owner_id, question) question = question_domain.Question( 'dummy2', 'A Question2', exp_domain.State.create_default_state('ABC').to_dict(), 1, 'en') question2_id = question_services.add_question(self.owner_id, question) questions = question_services.get_questions_by_ids( [question1_id, question2_id]) self.assertEqual(len(questions), 2) self.assertEqual(questions[0].title, 'A Question') self.assertEqual(questions[1].title, 'A Question2')
def test_integration(self): """Tests to create, update and delete questions. """ payload = {} payload['question'] = self.question.to_dict() self.login(self.NEW_USER_EMAIL) response = self.testapp.get('/preferences') csrf_token = self.get_csrf_token_from_response(response) response_json = self.post_json(feconf.QUESTION_CREATION_URL, payload, csrf_token, expect_errors=False) self.assertIn('question_id', response_json.keys()) another_question = question_domain.Question( 'dummy', 'Question 2', exp_domain.State.create_default_state('ABC').to_dict(), 1, 'en') payload['question'] = another_question.to_dict() response_json = self.post_json(feconf.QUESTION_CREATION_URL, payload, csrf_token, expect_errors=False) self.assertIn('question_id', response_json.keys()) another_question_id = response_json['question_id'] response = self.testapp.delete( '%s/%s' % (feconf.QUESTION_DATA_URL, str(another_question_id)), csrf_token, expect_errors=False) self.assertEqual(response.status_int, 200)
def get_question_from_model(question_model): """Returns domain object representing the given question model. Args: question_model: QuestionModel. The question model loaded from the datastore. Returns: Question. The domain object representing the question model. """ # Ensure the original question model does not get altered. versioned_question_state = { 'state_schema_version': ( question_model.question_state_data_schema_version), 'state': copy.deepcopy( question_model.question_state_data) } # Migrate the question if it is not using the latest schema version. if (question_model.question_state_data_schema_version != feconf.CURRENT_STATE_SCHEMA_VERSION): _migrate_state_schema(versioned_question_state) return question_domain.Question( question_model.id, state_domain.State.from_dict(versioned_question_state['state']), versioned_question_state['state_schema_version'], question_model.language_code, question_model.version, question_model.linked_skill_ids, question_model.created_on, question_model.last_updated)
def setUp(self): """Before each individual test, create a question.""" super(QuestionDomainTest, self).setUp() question_state_data = self._create_valid_question_data('ABC') self.question = question_domain.Question( 'question_id', question_state_data, feconf.CURRENT_EXPLORATION_STATES_SCHEMA_VERSION, 'en', 1)
def test_validation(self): """Test to verify validate method of Question domain object.""" state = exp_domain.State.create_default_state('ABC') question_data = state.to_dict() test_object = { 'question_id': 'col1.random', 'title': 'abc', 'question_data': question_data, 'question_data_schema_version': 1, 'collection_id': 'col1', 'language_code': 'en' } question = question_domain.Question( test_object['question_id'], test_object['title'], test_object['question_data'], test_object['question_data_schema_version'], test_object['collection_id'], test_object['language_code']) question.question_id = 123 with self.assertRaisesRegexp(utils.ValidationError, ( 'Expected ID to be a string')): question.validate() question.question_id = 'col1.random' question.update_title(1) with self.assertRaisesRegexp(utils.ValidationError, ( 'Expected title to be a string')): question.validate() question.update_title('ABC') question.update_question_data([]) with self.assertRaisesRegexp(utils.ValidationError, ( 'Expected question_data to be a dict')): question.validate() question.update_question_data(question_data) question.question_data_schema_version = 'abc' with self.assertRaisesRegexp(utils.ValidationError, ( 'Expected question_data_schema_version to be a integer')): question.validate() question.question_data_schema_version = 1 question.collection_id = 123 with self.assertRaisesRegexp(utils.ValidationError, ( 'Expected collection_id to be a string')): question.validate() question.collection_id = 'col1' question.language_code = 123 with self.assertRaisesRegexp(utils.ValidationError, ( 'Expected language_code to be a string')): question.validate() question.update_language_code('abc') with self.assertRaisesRegexp(utils.ValidationError, ( 'Invalid language code')): question.validate()
def test_get_question_by_id(self): question = question_domain.Question( 'dummy', self._create_valid_question_data('ABC'), 1, 'en') question_id = question_services.add_question(self.owner_id, question) question = question_services.get_question_by_id(question_id) self.assertEqual(question.question_id, question_id)
def setUp(self): """Before each individual test, create a question.""" super(QuestionDomainTest, self).setUp() question_state_data = self._create_valid_question_data('ABC') self.question = question_domain.Question( 'question_id', question_state_data, feconf.CURRENT_STATE_SCHEMA_VERSION, 'en', 1, ['skill1'], ['skillId12345-123'])
def setUp(self): super(QuestionsBatchHandlerTest, self).setUp() self.collection_id = 'coll_0' self.exp_id = 'exp_1' self.owner_id = self.get_user_id_from_email(self.OWNER_EMAIL) self.viewer_id = self.get_user_id_from_email(self.VIEWER_EMAIL) # Create a new collection and exploration. self.save_new_valid_collection(self.collection_id, self.owner_id, exploration_id=self.exp_id) # Add a skill. collection_services.update_collection( self.owner_id, self.collection_id, [{ 'cmd': collection_domain.CMD_ADD_COLLECTION_SKILL, 'name': 'test' }], 'Add a new skill') collection = collection_services.get_collection_by_id( self.collection_id) self.skill_id = collection.get_skill_id_from_skill_name('test') collection_node = collection.get_node(self.exp_id) collection_node.update_acquired_skill_ids([self.skill_id]) # Update the acquired skill IDs for the exploration. collection_services.update_collection( self.owner_id, self.collection_id, [{ 'cmd': collection_domain.CMD_EDIT_COLLECTION_NODE_PROPERTY, 'property_name': (collection_domain.COLLECTION_NODE_PROPERTY_ACQUIRED_SKILL_IDS ), # pylint: disable=line-too-long 'exploration_id': self.exp_id, 'new_value': [self.skill_id] }], 'Update skill') question = question_domain.Question( 'dummy', 'A Question', exp_domain.State.create_default_state('ABC').to_dict(), 1, self.collection_id, 'en') question_id = question_services.add_question(self.owner_id, question) self.question = question_services.get_question_by_id(question_id) question_services.add_question_id_to_skill(self.question.question_id, self.question.collection_id, self.skill_id, self.owner_id) self.signup(self.NEW_USER_EMAIL, self.NEW_USER_USERNAME) self.new_user_id = self.get_user_id_from_email(self.NEW_USER_EMAIL) collection_services.record_played_exploration_in_collection_context( self.new_user_id, self.collection_id, self.exp_id) self.payload = {}
def test_get_question_by_id(self): question = question_domain.Question( 'dummy', 'A Question', exp_domain.State.create_default_state('ABC').to_dict(), 1, 'en') question_id = question_services.add_question(self.owner_id, question) question = question_services.get_question_by_id(question_id) self.assertEqual(question.title, 'A Question')
def _create_dummy_question( self, question_id, question_content, linked_skill_ids): """Creates a dummy question object with the given question ID. Args: question_id: str. The ID of the question to be created. question_content: str. The question content. linked_skill_ids: list(str). The IDs of the skills to which the question is linked to. Returns: Question. The dummy question with given values. """ state = state_domain.State.create_default_state( 'ABC', is_initial_state=True) state.update_interaction_id('TextInput') state.update_content(state_domain.SubtitledHtml('1', question_content)) recorded_voiceovers = state_domain.RecordedVoiceovers({}) written_translations = state_domain.WrittenTranslations({}) recorded_voiceovers.add_content_id_for_voiceover('1') recorded_voiceovers.add_content_id_for_voiceover('default_outcome') written_translations.add_content_id_for_translation('1') written_translations.add_content_id_for_translation('default_outcome') state.update_recorded_voiceovers(recorded_voiceovers) state.update_written_translations(written_translations) solution_dict = ( state_domain.Solution( 'TextInput', False, 'Solution', state_domain.SubtitledHtml( 'solution', '<p>This is a solution.</p>')).to_dict()) hints_list = [ state_domain.Hint( state_domain.SubtitledHtml('hint_1', '<p>This is a hint.</p>') ) ] state.update_interaction_solution(solution_dict) state.update_interaction_hints(hints_list) state.update_interaction_customization_args({ 'placeholder': 'Enter text here', 'rows': 1 }) state.update_interaction_default_outcome( state_domain.Outcome( None, state_domain.SubtitledHtml( 'feedback_id', '<p>Dummy Feedback</p>'), True, [], None, None ) ) question = question_domain.Question( question_id, state, feconf.CURRENT_STATE_SCHEMA_VERSION, constants.DEFAULT_LANGUAGE_CODE, 0, linked_skill_ids) return question
def test_delete_question(self): question = question_domain.Question( 'dummy', self._create_valid_question_data('ABC'), 1, 'en') question_id = question_services.add_question(self.owner_id, question) question_services.delete_question(self.owner_id, question_id) with self.assertRaisesRegexp( Exception, ('Entity for class QuestionModel with id %s not found' % (question_id))): question_models.QuestionModel.get(question_id)
def test_delete_question(self): question = question_domain.Question( 'dummy', 'A Question', exp_domain.State.create_default_state('ABC').to_dict(), 1, 'en') question_id = question_services.add_question(self.owner_id, question) question_services.delete_question(self.owner_id, question_id) with self.assertRaisesRegexp( Exception, ('Entity for class QuestionModel with id %s not found' % (question_id))): question_models.QuestionModel.get(question_id)
def setUp(self): super(QuestionsHandlersTest, self).setUp() self.exp_id = 'exp_1' self.owner_id = self.get_user_id_from_email(self.OWNER_EMAIL) self.random_email = '*****@*****.**' self.signup(self.random_email, 'abc') self.signup(self.NEW_USER_EMAIL, self.NEW_USER_USERNAME) self.new_user_id = self.get_user_id_from_email(self.NEW_USER_EMAIL) self.set_moderators([self.NEW_USER_USERNAME]) self.question = question_domain.Question( 'dummy', self._create_valid_question_data('ABC'), 1, 'en')
def test_to_dict(self): expected_object = { 'question_id': 'col1.random', 'question_data': {}, 'question_data_schema_version': 1, 'language_code': 'en' } observed_object = question_domain.Question( expected_object['question_id'], expected_object['question_data'], expected_object['question_data_schema_version'], expected_object['language_code']) self.assertDictEqual(expected_object, observed_object.to_dict())
def validate(self): """Validates a suggestion object of type SuggestionAddQuestion. Raises: ValidationError: One or more attributes of the SuggestionAddQuestion object are invalid. """ super(SuggestionAddQuestion, self).validate() if self.get_score_type() != suggestion_models.SCORE_TYPE_QUESTION: raise utils.ValidationError( 'Expected the first part of score_category to be "%s" ' ', received "%s"' % ( suggestion_models.SCORE_TYPE_QUESTION, self.get_score_type())) if not isinstance(self.change, question_domain.QuestionChange): raise utils.ValidationError( 'Expected change to be an instance of QuestionChange') if not self.change.cmd: raise utils.ValidationError('Expected change to contain cmd') if ( self.change.cmd != question_domain.CMD_CREATE_NEW_FULLY_SPECIFIED_QUESTION): raise utils.ValidationError('Expected cmd to be %s, obtained %s' % ( question_domain.CMD_CREATE_NEW_FULLY_SPECIFIED_QUESTION, self.change.cmd)) if not self.change.question_dict: raise utils.ValidationError( 'Expected change to contain question_dict') question = question_domain.Question( None, exp_domain.State.from_dict( self.change.question_dict['question_state_data']), self.change.question_dict['question_state_schema_version'], self.change.question_dict['language_code'], None) question.partial_validate() question_state_schema_version = ( self.change.question_dict['question_state_schema_version']) if not ( question_state_schema_version >= 1 and question_state_schema_version <= feconf.CURRENT_STATES_SCHEMA_VERSION): raise utils.ValidationError( 'Expected question state schema version to be between 1 and ' '%s' % feconf.CURRENTSTATES_SCHEMA_VERSION) if not self.change.skill_id: raise utils.ValidationError('Expected change to contain skill_id')
def test_get_question_batch(self): coll_id_0 = '0_collection_id' exp_id_0 = '0_exploration_id' self.owner_id = self.get_user_id_from_email(self.OWNER_EMAIL) # Create a new collection and exploration. self.save_new_valid_collection(coll_id_0, self.owner_id, exploration_id=exp_id_0) # Add a skill. collection_services.update_collection( self.owner_id, coll_id_0, [{ 'cmd': collection_domain.CMD_ADD_COLLECTION_SKILL, 'name': 'skill0' }], 'Add a new skill') collection = collection_services.get_collection_by_id(coll_id_0) skill_id = collection.get_skill_id_from_skill_name('skill0') collection_node = collection.get_node(exp_id_0) collection_node.update_acquired_skill_ids([skill_id]) # Update the acquired skill IDs for the exploration. collection_services.update_collection( self.owner_id, coll_id_0, [{ 'cmd': collection_domain.CMD_EDIT_COLLECTION_NODE_PROPERTY, 'property_name': (collection_domain.COLLECTION_NODE_PROPERTY_ACQUIRED_SKILL_IDS ), # pylint: disable=line-too-long 'exploration_id': exp_id_0, 'new_value': [skill_id] }], 'Update skill') question = question_domain.Question( 'dummy', 'A Question', exp_domain.State.create_default_state('ABC').to_dict(), 1, coll_id_0, 'en') question_id = question_services.add_question(self.owner_id, question) question = question_services.get_question_by_id(question_id) question_services.add_question_id_to_skill(question.question_id, coll_id_0, skill_id, self.owner_id) collection_services.record_played_exploration_in_collection_context( self.owner_id, coll_id_0, exp_id_0) question_batch = question_services.get_questions_batch( coll_id_0, [skill_id], self.owner_id, 1) self.assertEqual(question_batch[0].title, question.title)
def test_integration(self): """Tests to create, update, delete questions and fetch questions summaries only using handlers. """ payload = {} payload['question'] = self.question.to_dict() payload['skill_id'] = self.skill_id self.login(self.NEW_USER_EMAIL) response = self.testapp.get('/preferences') csrf_token = self.get_csrf_token_from_response(response) response_json = self.post_json( '%s' % feconf.QUESTION_CREATION_URL, payload, csrf_token, expect_errors=False) self.assertIn('question_id', response_json.keys()) question_id = response_json['question_id'] another_question = question_domain.Question( 'dummy', 'Question 2', exp_domain.State.create_default_state('ABC').to_dict(), 1, self.collection_id, 'en') payload['question'] = another_question.to_dict() payload['skill_id'] = self.skill_id response_json = self.post_json( '%s' % feconf.QUESTION_CREATION_URL, payload, csrf_token, expect_errors=False) self.assertIn('question_id', response_json.keys()) another_question_id = response_json['question_id'] del payload['question'] del payload['skill_id'] payload['collection_id'] = self.collection_id response_json = self.get_json( '%s' % feconf.QUESTION_MANAGER_URL, payload, expect_errors=False) self.assertIn('question_summary_dicts', response_json.keys()) question_summary_dicts = response_json['question_summary_dicts'] self.assertEqual(len(question_summary_dicts), 2) response = self.testapp.delete( '%s/%s/%s' % ( feconf.QUESTION_DATA_URL, self.collection_id, str(another_question_id)), csrf_token, expect_errors=False) self.assertEqual(response.status_int, 200) response_json = self.get_json( '%s' % feconf.QUESTION_MANAGER_URL, payload, expect_errors=False) self.assertIn('question_summary_dicts', response_json.keys()) question_summary_dicts = response_json['question_summary_dicts'] self.assertEqual(len(question_summary_dicts), 1) self.assertIn(question_id, question_summary_dicts[0]['question_id'])
def get_question_from_model(question_model): """Returns domain object repersenting the given question model. Args: question_model: QuestionModel. The question model loaded from the datastore. Returns: Question. The domain object representing the question model. """ return question_domain.Question( question_model.id, question_model.question_data, question_model.question_data_schema_version, question_model.language_code)
def test_add_question(self): question_data = self._create_valid_question_data('ABC') question_id = 'dummy' question_data_schema_version = 1 language_code = 'en' question = question_domain.Question(question_id, question_data, question_data_schema_version, language_code) question_id = question_services.add_question(self.owner_id, question) model = question_models.QuestionModel.get(question_id) self.assertEqual(model.question_data, question_data) self.assertEqual(model.question_data_schema_version, question_data_schema_version) self.assertEqual(model.language_code, language_code)
def get_question_from_model(question_model): """Returns domain object repersenting the given question model. Args: question_model: QuestionModel. The question model loaded from the datastore. Returns: Question. The domain object representing the question model. """ return question_domain.Question( question_model.id, exp_domain.State.from_dict(question_model.question_state_data), question_model.question_state_schema_version, question_model.language_code, question_model.version, question_model.created_on, question_model.last_updated)
def test_add_question(self): state = exp_domain.State.create_default_state('ABC') question_data = state.to_dict() question_id = 'dummy' title = 'A Question' question_data_schema_version = 1 language_code = 'en' question = question_domain.Question(question_id, title, question_data, question_data_schema_version, language_code) question_id = question_services.add_question(self.owner_id, question) model = question_models.QuestionModel.get(question_id) self.assertEqual(model.title, title) self.assertEqual(model.question_data, question_data) self.assertEqual(model.question_data_schema_version, question_data_schema_version) self.assertEqual(model.language_code, language_code)
def test_validation(self): """Test to verify validate method of Question domain object.""" question_data = self._create_valid_question_data('ABC') test_object = { 'question_id': 'col1.random', 'question_data': question_data, 'question_data_schema_version': 1, 'language_code': 'en' } question = question_domain.Question( test_object['question_id'], test_object['question_data'], test_object['question_data_schema_version'], test_object['language_code']) question.question_id = 123 with self.assertRaisesRegexp(utils.ValidationError, ('Expected ID to be a string')): question.validate() question.question_id = 'col1.random' question.update_question_data([]) with self.assertRaisesRegexp(utils.ValidationError, ('Expected question_data to be a dict')): question.validate() question.update_question_data(question_data) question.question_data_schema_version = 'abc' with self.assertRaisesRegexp( utils.ValidationError, ('Expected question_data_schema_version to be a integer')): question.validate() question.question_data_schema_version = 1 question.update_language_code('abc') with self.assertRaisesRegexp(utils.ValidationError, ('Invalid language code')): question.validate()
def test_update_question(self): state = exp_domain.State.create_default_state('ABC') question_data = state.to_dict() question_id = 'dummy' title = 'A Question' question_data_schema_version = 1 collection_id = 'col1' language_code = 'en' question = question_domain.Question(question_id, title, question_data, question_data_schema_version, collection_id, language_code) question_id = question_services.add_question(self.owner_id, question) change_dict = { 'cmd': 'update_question_property', 'property_name': 'title', 'new_value': 'ABC', 'old_value': 'A Question' } change_list = [question_domain.QuestionChange(change_dict)] with self.assertRaisesRegexp( Exception, ('The question with ID %s is not present' ' in the given collection' % question_id)): question_services.update_question(self.owner_id, 'random', question_id, change_list, 'updated') question_services.update_question(self.owner_id, collection_id, question_id, change_list, ('updated title')) model = question_models.QuestionModel.get(question_id) self.assertEqual(model.title, 'ABC') self.assertEqual(model.question_data, question_data) self.assertEqual(model.question_data_schema_version, question_data_schema_version) self.assertEqual(model.collection_id, collection_id) self.assertEqual(model.language_code, language_code)
def test_delete_question(self): collection_id = 'col1' exp_id = '0_exploration_id' owner_id = self.get_user_id_from_email(self.OWNER_EMAIL) # Create a new collection and exploration. self.save_new_valid_collection(collection_id, owner_id, exploration_id=exp_id) # Add a skill. collection_services.update_collection( owner_id, collection_id, [{ 'cmd': collection_domain.CMD_ADD_COLLECTION_SKILL, 'name': 'skill0' }], 'Add a new skill') question = question_domain.Question( 'dummy', 'A Question', exp_domain.State.create_default_state('ABC').to_dict(), 1, collection_id, 'en') question_id = question_services.add_question(self.owner_id, question) with self.assertRaisesRegexp( Exception, ('The question with ID %s is not present' ' in the given collection' % question_id)): question_services.delete_question(self.owner_id, 'random', question_id) question_services.delete_question(self.owner_id, collection_id, question_id) with self.assertRaisesRegexp( Exception, ('Entity for class QuestionModel with id %s not found' % (question_id))): question_models.QuestionModel.get(question_id)
def validate(self): """Validates a suggestion object of type SuggestionAddQuestion. Raises: ValidationError. One or more attributes of the SuggestionAddQuestion object are invalid. """ super(SuggestionAddQuestion, self).validate() if self.get_score_type() != suggestion_models.SCORE_TYPE_QUESTION: raise utils.ValidationError( 'Expected the first part of score_category to be "%s" ' ', received "%s"' % (suggestion_models.SCORE_TYPE_QUESTION, self.get_score_type())) if not isinstance(self.change, question_domain.QuestionSuggestionChange): raise utils.ValidationError( 'Expected change to be an instance of QuestionSuggestionChange' ) if not self.change.cmd: raise utils.ValidationError('Expected change to contain cmd') if (self.change.cmd != question_domain.CMD_CREATE_NEW_FULLY_SPECIFIED_QUESTION): raise utils.ValidationError( 'Expected cmd to be %s, obtained %s' % (question_domain.CMD_CREATE_NEW_FULLY_SPECIFIED_QUESTION, self.change.cmd)) if not self.change.question_dict: raise utils.ValidationError( 'Expected change to contain question_dict') if self.language_code is None: raise utils.ValidationError('language_code cannot be None') if self.language_code != self.change.question_dict['language_code']: raise utils.ValidationError( 'Expected language_code to be %s, received %s' % (self.change.question_dict['language_code'], self.language_code)) if not self.change.skill_difficulty: raise utils.ValidationError( 'Expected change to contain skill_difficulty') skill_difficulties = list( constants.SKILL_DIFFICULTY_LABEL_TO_FLOAT.values()) if self._get_skill_difficulty() not in skill_difficulties: raise utils.ValidationError( 'Expected change skill_difficulty to be one of %s, found %s ' % (skill_difficulties, self._get_skill_difficulty())) question = question_domain.Question( None, state_domain.State.from_dict( self.change.question_dict['question_state_data']), self.change.question_dict['question_state_data_schema_version'], self.change.question_dict['language_code'], None, self.change.question_dict['linked_skill_ids'], self.change.question_dict['inapplicable_skill_misconception_ids']) question.partial_validate() question_state_data_schema_version = ( self.change.question_dict['question_state_data_schema_version']) if not (question_state_data_schema_version >= 1 and question_state_data_schema_version <= feconf.CURRENT_STATE_SCHEMA_VERSION): raise utils.ValidationError( 'Expected question state schema version to be between 1 and ' '%s' % feconf.CURRENT_STATE_SCHEMA_VERSION)