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


Python BlockUsageLocator.version_agnostic方法代码示例

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


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

示例1: test_block_constructor

# 需要导入模块: from xmodule.modulestore.locator import BlockUsageLocator [as 别名]
# 或者: from xmodule.modulestore.locator.BlockUsageLocator import version_agnostic [as 别名]
 def test_block_constructor(self):
     testurn = "mit.eecs.6002x" + BRANCH_PREFIX + "published" + BLOCK_PREFIX + "HW3"
     expected_id = "mit.eecs.6002x"
     expected_branch = "published"
     expected_block_ref = "HW3"
     testobj = BlockUsageLocator(course_id=testurn)
     self.check_block_locn_fields(
         testobj, "test_block constructor", course_id=expected_id, branch=expected_branch, block=expected_block_ref
     )
     self.assertEqual(str(testobj), testurn)
     self.assertEqual(testobj.url(), "edx://" + testurn)
     agnostic = testobj.version_agnostic()
     self.assertIsNone(agnostic.version_guid)
     self.check_block_locn_fields(
         agnostic, "test_block constructor", course_id=expected_id, branch=expected_branch, block=expected_block_ref
     )
开发者ID:rjsheperd,项目名称:edx-platform,代码行数:18,代码来源:test_locators.py

示例2: test_block_constructor

# 需要导入模块: from xmodule.modulestore.locator import BlockUsageLocator [as 别名]
# 或者: from xmodule.modulestore.locator.BlockUsageLocator import version_agnostic [as 别名]
 def test_block_constructor(self):
     testurn = 'mit.eecs.6002x/' + BRANCH_PREFIX + 'published/' + BLOCK_PREFIX + 'HW3'
     expected_id = 'mit.eecs.6002x'
     expected_branch = 'published'
     expected_block_ref = 'HW3'
     testobj = BlockUsageLocator(package_id=testurn)
     self.check_block_locn_fields(testobj, 'test_block constructor',
                                  package_id=expected_id,
                                  branch=expected_branch,
                                  block=expected_block_ref)
     self.assertEqual(str(testobj), testurn)
     self.assertEqual(testobj.url(), 'edx://' + testurn)
     agnostic = testobj.version_agnostic()
     self.assertIsNone(agnostic.version_guid)
     self.check_block_locn_fields(agnostic, 'test_block constructor',
                                  package_id=expected_id,
                                  branch=expected_branch,
                                  block=expected_block_ref)
开发者ID:Caesar73,项目名称:edx-platform,代码行数:20,代码来源:test_locators.py

示例3: test_block_constructor_url_version_prefix

# 需要导入模块: from xmodule.modulestore.locator import BlockUsageLocator [as 别名]
# 或者: from xmodule.modulestore.locator.BlockUsageLocator import version_agnostic [as 别名]
 def test_block_constructor_url_version_prefix(self):
     test_id_loc = '519665f6223ebd6980884f2b'
     testobj = BlockUsageLocator(
         url='edx://mit.eecs.6002x/{}{}/{}lab2'.format(VERSION_PREFIX, test_id_loc, BLOCK_PREFIX)
     )
     self.check_block_locn_fields(
         testobj, 'error parsing URL with version and block',
         package_id='mit.eecs.6002x',
         block='lab2',
         version_guid=ObjectId(test_id_loc)
     )
     agnostic = testobj.version_agnostic()
     self.check_block_locn_fields(
         agnostic, 'error parsing URL with version and block',
         block='lab2',
         package_id=None,
         version_guid=ObjectId(test_id_loc)
     )
     self.assertIsNone(agnostic.package_id)
开发者ID:Caesar73,项目名称:edx-platform,代码行数:21,代码来源:test_locators.py

示例4: test_block_constructor_url_version_prefix

# 需要导入模块: from xmodule.modulestore.locator import BlockUsageLocator [as 别名]
# 或者: from xmodule.modulestore.locator.BlockUsageLocator import version_agnostic [as 别名]
 def test_block_constructor_url_version_prefix(self):
     test_id_loc = "519665f6223ebd6980884f2b"
     testobj = BlockUsageLocator(url="edx://mit.eecs.6002x" + VERSION_PREFIX + test_id_loc + BLOCK_PREFIX + "lab2")
     self.check_block_locn_fields(
         testobj,
         "error parsing URL with version and block",
         course_id="mit.eecs.6002x",
         block="lab2",
         version_guid=ObjectId(test_id_loc),
     )
     agnostic = testobj.version_agnostic()
     self.check_block_locn_fields(
         agnostic,
         "error parsing URL with version and block",
         block="lab2",
         course_id=None,
         version_guid=ObjectId(test_id_loc),
     )
     self.assertIsNone(agnostic.course_id)
开发者ID:rjsheperd,项目名称:edx-platform,代码行数:21,代码来源:test_locators.py


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