本文整理汇总了Python中intercom.user.User.custom_attributes["thing"]方法的典型用法代码示例。如果您正苦于以下问题:Python User.custom_attributes["thing"]方法的具体用法?Python User.custom_attributes["thing"]怎么用?Python User.custom_attributes["thing"]使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类intercom.user.User
的用法示例。
在下文中一共展示了User.custom_attributes["thing"]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: it_rejects_nested_data_structures_in_custom_attributes
# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import custom_attributes["thing"] [as 别名]
def it_rejects_nested_data_structures_in_custom_attributes(self):
user = User()
with assert_raises(ValueError):
user.custom_attributes["thing"] = [1]
with assert_raises(ValueError):
user.custom_attributes["thing"] = {1: 2}
with assert_raises(ValueError):
user.custom_attributes = {1: {2: 3}}
user = User.from_api(get_user())
with assert_raises(ValueError):
user.custom_attributes["thing"] = [1]
示例2: it_allows_easy_setting_of_custom_data
# 需要导入模块: from intercom.user import User [as 别名]
# 或者: from intercom.user.User import custom_attributes["thing"] [as 别名]
def it_allows_easy_setting_of_custom_data(self):
now = datetime.utcnow()
now_ts = calendar.timegm(now.utctimetuple())
user = User()
user.custom_attributes["mad"] = 123
user.custom_attributes["other"] = now_ts
user.custom_attributes["thing"] = "yay"
attrs = {"mad": 123, "other": now_ts, "thing": "yay"}
eq_(user.to_dict()["custom_attributes"], attrs)