本文整理汇总了Python中xblock.fields.String方法的典型用法代码示例。如果您正苦于以下问题:Python fields.String方法的具体用法?Python fields.String怎么用?Python fields.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xblock.fields
的用法示例。
在下文中一共展示了fields.String方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_explicit_overrides
# 需要导入模块: from xblock import fields [as 别名]
# 或者: from xblock.fields import String [as 别名]
def test_explicit_overrides(self):
"""
Test that we can override the defaults with the same value as the default, and that the
value will be saved explicitly.
"""
block = self.set_up_root_block()
self.assert_unchanged(block)
field_names = EditableXBlock.editable_fields
# It is crucial to this test that at least one of the fields is a String field with
# an empty string as its default value:
defaults = set([block.fields[field_name].default for field_name in field_names])
self.assertIn(u'', defaults)
for field_name in field_names:
control = self.get_element_for_field(field_name)
control.send_keys('9999') # In case the field is blank and the new value is blank, this forces a change
control.clear()
control.send_keys(str(block.fields[field_name].default))
self.click_save()
self.assert_unchanged(block, explicitly_set=True)