本文整理汇总了Python中dictset.DictSet.add方法的典型用法代码示例。如果您正苦于以下问题:Python DictSet.add方法的具体用法?Python DictSet.add怎么用?Python DictSet.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dictset.DictSet
的用法示例。
在下文中一共展示了DictSet.add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test4
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import add [as 别名]
def test4(self):
L = DictSet(s2d('a1 c5666788'))
with self.assertRaises(TypeError) as cm:
L.add('d',[])
self.assertEqual(str(cm.exception),
"unhashable type: 'list'")
示例2: test7
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import add [as 别名]
def test7(self):
L = DictSet(s2d('a123 b456 c0'))
R = s2l('a123 b456 c0')
L.add('c') # shouldn't do anything
self.assertEqual(d2l(L),R)
示例3: test6
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import add [as 别名]
def test6(self):
L = DictSet(s2d('b456'))
R = s2l('b456 c0')
L.add('c')
self.assertEqual(d2l(L),R)
示例4: test5
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import add [as 别名]
def test5(self):
L = DictSet(s2d('b456'))
R = s2l('b456')
L.add('b')
self.assertEqual(d2l(L),R) # b should stay unaltered
示例5: test3
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import add [as 别名]
def test3(self):
L = DictSet(s2d('a1 c5666788'))
R = s2l('a1 c56 78 d7')
L.add('d','7') # create new set
self.assertEqual(d2l(L),R)
示例6: test1
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import add [as 别名]
def test1(self):
L = DictSet(s2d('a1 c5666788'))
R = s2l('a1 c56 78')
L.add('c','7') # does nothing to existing set
self.assertEqual(d2l(L),R)
示例7: test0
# 需要导入模块: from dictset import DictSet [as 别名]
# 或者: from dictset.DictSet import add [as 别名]
def test0(self):
L = DictSet(s2d('a1 c5666788'))
R = s2l('a1 c56 78 9')
L.add('c','9') # add to existing set
self.assertEqual(d2l(L),R)