当前位置: 首页>>代码示例>>Python>>正文


Python OptionResponseXMLFactory.build_xml方法代码示例

本文整理汇总了Python中capa.tests.response_xml_factory.OptionResponseXMLFactory.build_xml方法的典型用法代码示例。如果您正苦于以下问题:Python OptionResponseXMLFactory.build_xml方法的具体用法?Python OptionResponseXMLFactory.build_xml怎么用?Python OptionResponseXMLFactory.build_xml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在capa.tests.response_xml_factory.OptionResponseXMLFactory的用法示例。


在下文中一共展示了OptionResponseXMLFactory.build_xml方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: redefine_option_problem

# 需要导入模块: from capa.tests.response_xml_factory import OptionResponseXMLFactory [as 别名]
# 或者: from capa.tests.response_xml_factory.OptionResponseXMLFactory import build_xml [as 别名]
 def redefine_option_problem(self, problem_url_name):
     """Change the problem definition so the answer is Option 2"""
     factory = OptionResponseXMLFactory()
     factory_args = {'question_text': 'The correct answer is {0}'.format(OPTION_2),
                     'options': [OPTION_1, OPTION_2],
                     'correct_option': OPTION_2,
                     'num_responses': 2}
     problem_xml = factory.build_xml(**factory_args)
     location = InstructorTaskTestCase.problem_location(problem_url_name)
     self.module_store.update_item(location, problem_xml)
开发者ID:LukeLu1263,项目名称:edx-platform,代码行数:12,代码来源:test_base.py

示例2: redefine_option_problem

# 需要导入模块: from capa.tests.response_xml_factory import OptionResponseXMLFactory [as 别名]
# 或者: from capa.tests.response_xml_factory.OptionResponseXMLFactory import build_xml [as 别名]
 def redefine_option_problem(self, problem_url_name, correct_answer=OPTION_1, num_inputs=1, num_responses=2):
     """Change the problem definition so the answer is Option 2"""
     factory = OptionResponseXMLFactory()
     factory_args = self._option_problem_factory_args(correct_answer, num_inputs, num_responses)
     problem_xml = factory.build_xml(**factory_args)
     location = InstructorTaskTestCase.problem_location(problem_url_name)
     item = self.module_store.get_item(location)
     with self.module_store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, location.course_key):
         item.data = problem_xml
         self.module_store.update_item(item, self.user.id)
         self.module_store.publish(location, self.user.id)
开发者ID:TeachAtTUM,项目名称:edx-platform,代码行数:13,代码来源:test_base.py

示例3: define_option_problem

# 需要导入模块: from capa.tests.response_xml_factory import OptionResponseXMLFactory [as 别名]
# 或者: from capa.tests.response_xml_factory.OptionResponseXMLFactory import build_xml [as 别名]
 def define_option_problem(self, problem_url_name):
     """Create the problem definition so the answer is Option 1"""
     factory = OptionResponseXMLFactory()
     factory_args = {'question_text': 'The correct answer is {0}'.format(OPTION_1),
                     'options': [OPTION_1, OPTION_2],
                     'correct_option': OPTION_1,
                     'num_responses': 2}
     problem_xml = factory.build_xml(**factory_args)
     ItemFactory.create(parent_location=self.problem_section.location,
                        category="problem",
                        display_name=str(problem_url_name),
                        data=problem_xml)
开发者ID:LukeLu1263,项目名称:edx-platform,代码行数:14,代码来源:test_base.py

示例4: define_option_problem

# 需要导入模块: from capa.tests.response_xml_factory import OptionResponseXMLFactory [as 别名]
# 或者: from capa.tests.response_xml_factory.OptionResponseXMLFactory import build_xml [as 别名]
 def define_option_problem(self, problem_url_name, parent=None, **kwargs):
     """Create the problem definition so the answer is Option 1"""
     if parent is None:
         parent = self.problem_section
     factory = OptionResponseXMLFactory()
     factory_args = self._option_problem_factory_args()
     problem_xml = factory.build_xml(**factory_args)
     ItemFactory.create(parent_location=parent.location,
                        parent=parent,
                        category="problem",
                        display_name=problem_url_name,
                        data=problem_xml,
                        **kwargs)
开发者ID:TeachAtTUM,项目名称:edx-platform,代码行数:15,代码来源:test_base.py

示例5: redefine_option_problem

# 需要导入模块: from capa.tests.response_xml_factory import OptionResponseXMLFactory [as 别名]
# 或者: from capa.tests.response_xml_factory.OptionResponseXMLFactory import build_xml [as 别名]
 def redefine_option_problem(self, problem_url_name):
     """Change the problem definition so the answer is Option 2"""
     factory = OptionResponseXMLFactory()
     factory_args = {'question_text': 'The correct answer is {0}'.format(OPTION_2),
                     'options': [OPTION_1, OPTION_2],
                     'correct_option': OPTION_2,
                     'num_responses': 2}
     problem_xml = factory.build_xml(**factory_args)
     location = InstructorTaskTestCase.problem_location(problem_url_name)
     item = self.module_store.get_item(location)
     with self.module_store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, location.course_key):
         item.data = problem_xml
         self.module_store.update_item(item, self.user.id)
         self.module_store.publish(location, self.user.id)
开发者ID:10clouds,项目名称:edx-platform,代码行数:16,代码来源:test_base.py

示例6: define_option_problem

# 需要导入模块: from capa.tests.response_xml_factory import OptionResponseXMLFactory [as 别名]
# 或者: from capa.tests.response_xml_factory.OptionResponseXMLFactory import build_xml [as 别名]
 def define_option_problem(self, problem_url_name, parent=None, **kwargs):
     """Create the problem definition so the answer is Option 1"""
     if parent is None:
         parent = self.problem_section
     factory = OptionResponseXMLFactory()
     factory_args = {
         "question_text": "The correct answer is {0}".format(OPTION_1),
         "options": [OPTION_1, OPTION_2],
         "correct_option": OPTION_1,
         "num_responses": 2,
     }
     problem_xml = factory.build_xml(**factory_args)
     ItemFactory.create(
         parent_location=parent.location,
         parent=parent,
         category="problem",
         display_name=problem_url_name,
         data=problem_xml,
         **kwargs
     )
开发者ID:longmen21,项目名称:edx-platform,代码行数:22,代码来源:test_base.py


注:本文中的capa.tests.response_xml_factory.OptionResponseXMLFactory.build_xml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。