我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用types.insert()。
def test_inputtypes(self): s = 'abracadabra' types = [list, tuple] if have_unicode: types.insert(0, unicode) for T in types: self.assertEqual(sorted(s), sorted(T(s))) s = ''.join(dict.fromkeys(s).keys()) # unique letters only types = [set, frozenset, list, tuple, dict.fromkeys] if have_unicode: types.insert(0, unicode) for T in types: self.assertEqual(sorted(s), sorted(T(s)))
def test_inputtypes(self): s = 'abracadabra' types = [list, tuple] if True: # Was: if have_unicode: types.insert(0, unicode) for T in types: self.assertEqual(sorted(s), sorted(T(s))) s = ''.join(dict.fromkeys(s).keys()) # unique letters only types = [set, frozenset, list, tuple, dict.fromkeys] if True: # Was: if have_unicode: types.insert(0, unicode) for T in types: self.assertEqual(sorted(s), sorted(T(s)))