mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Better tests for posixpath.commonprefix
This commit is contained in:
		
							parent
							
								
									e3e62b3783
								
							
						
					
					
						commit
						a74b67e15e
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		|  | @ -130,6 +130,16 @@ def test_commonprefix(self): | |||
|             "/home/swen/spam" | ||||
|         ) | ||||
| 
 | ||||
|         testlist = ['', 'abc', 'Xbcd', 'Xb', 'XY', 'abcd', 'aXc', 'abd', 'ab', 'aX', 'abcX'] | ||||
|         for s1 in testlist: | ||||
|             for s2 in testlist: | ||||
|                 p = posixpath.commonprefix([s1, s2]) | ||||
|                 self.assert_(s1.startswith(p)) | ||||
|                 self.assert_(s2.startswith(p)) | ||||
|                 if s1 != s2: | ||||
|                     n = len(p) | ||||
|                     self.assertNotEqual(s1[n:n+1], s2[n:n+1]) | ||||
| 
 | ||||
|     def test_getsize(self): | ||||
|         f = open(test_support.TESTFN, "wb") | ||||
|         try: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Raymond Hettinger
						Raymond Hettinger