本文整理汇总了Python中stormpath.resources.custom_data.CustomData._set_properties方法的典型用法代码示例。如果您正苦于以下问题:Python CustomData._set_properties方法的具体用法?Python CustomData._set_properties怎么用?Python CustomData._set_properties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stormpath.resources.custom_data.CustomData
的用法示例。
在下文中一共展示了CustomData._set_properties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_manually_set_property_has_precedence
# 需要导入模块: from stormpath.resources.custom_data import CustomData [as 别名]
# 或者: from stormpath.resources.custom_data.CustomData import _set_properties [as 别名]
def test_manually_set_property_has_precedence(self):
props = {"href": "test/resource", "bar": "2", "baz": ["one", "two", "three"], "quux": {"key": "value"}}
d = CustomData(MagicMock(), properties=props)
d["quux"] = "a-little-corgi"
d._set_properties(props)
quux = d.data.pop("quux")
props.pop("quux")
props.pop("href")
# quux property is as set
self.assertEqual(quux, "a-little-corgi")
self.assertEqual(d.data, props)
示例2: test_manually_set_property_has_precedence
# 需要导入模块: from stormpath.resources.custom_data import CustomData [as 别名]
# 或者: from stormpath.resources.custom_data.CustomData import _set_properties [as 别名]
def test_manually_set_property_has_precedence(self):
props = {
'href': 'test/resource',
'bar': '2',
'baz': ['one', 'two', 'three'],
'quux': {'key': 'value'}
}
d = CustomData(MagicMock(), properties=props)
d['quux'] = 'a-little-corgi'
d._set_properties(props)
quux = d._data.pop('quux')
props.pop('quux')
props.pop('href')
# quux property is as set
self.assertEqual(quux, 'a-little-corgi')
self.assertEqual(d._data, props)