mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Add alternate constructor for itertools.chain().
This commit is contained in:
		
							parent
							
								
									05bf6338b8
								
							
						
					
					
						commit
						b4cbc98c39
					
				
					 3 changed files with 34 additions and 1 deletions
				
			
		|  | @ -52,6 +52,13 @@ def test_chain(self): | |||
|         self.assertEqual(take(4, chain('abc', 'def')), list('abcd')) | ||||
|         self.assertRaises(TypeError, list,chain(2, 3)) | ||||
| 
 | ||||
|     def test_chain_from_iterable(self): | ||||
|         self.assertEqual(list(chain.from_iterable(['abc', 'def'])), list('abcdef')) | ||||
|         self.assertEqual(list(chain.from_iterable(['abc'])), list('abc')) | ||||
|         self.assertEqual(list(chain.from_iterable([''])), []) | ||||
|         self.assertEqual(take(4, chain.from_iterable(['abc', 'def'])), list('abcd')) | ||||
|         self.assertRaises(TypeError, list, chain.from_iterable([2, 3])) | ||||
| 
 | ||||
|     def test_combinations(self): | ||||
|         self.assertRaises(TypeError, combinations, 'abc')   # missing r argument | ||||
|         self.assertRaises(TypeError, combinations, 'abc', 2, 1) # too many arguments | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Raymond Hettinger
						Raymond Hettinger