本文整理匯總了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)