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