mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Issue #1625: Add stream ordering test to test_bz2.
This commit is contained in:
		
							parent
							
								
									07d291ae59
								
							
						
					
					
						commit
						f3ecb83822
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -426,6 +426,17 @@ class BZ2FileTest(BaseTest):
 | 
				
			||||||
                next(bz2f)
 | 
					                next(bz2f)
 | 
				
			||||||
            self.assertEqual(bz2f.readlines(), [])
 | 
					            self.assertEqual(bz2f.readlines(), [])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def testMultiStreamOrdering(self):
 | 
				
			||||||
 | 
					        # Test the ordering of streams when reading a multi-stream archive.
 | 
				
			||||||
 | 
					        data1 = b"foo" * 1000
 | 
				
			||||||
 | 
					        data2 = b"bar" * 1000
 | 
				
			||||||
 | 
					        with BZ2File(self.filename, "w") as bz2f:
 | 
				
			||||||
 | 
					            bz2f.write(data1)
 | 
				
			||||||
 | 
					        with BZ2File(self.filename, "a") as bz2f:
 | 
				
			||||||
 | 
					            bz2f.write(data2)
 | 
				
			||||||
 | 
					        with BZ2File(self.filename) as bz2f:
 | 
				
			||||||
 | 
					            self.assertEqual(bz2f.read(), data1 + data2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Tests for a BZ2File wrapping another file object:
 | 
					    # Tests for a BZ2File wrapping another file object:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def testReadBytesIO(self):
 | 
					    def testReadBytesIO(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue