mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	Add test for opening an SQLite with bytes path (GH-136331)
This commit is contained in:
		
							parent
							
								
									b36d23f58e
								
							
						
					
					
						commit
						1bde13b0e9
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		|  | @ -630,6 +630,14 @@ def test_deserialize_corrupt_database(self): | ||||||
| class OpenTests(unittest.TestCase): | class OpenTests(unittest.TestCase): | ||||||
|     _sql = "create table test(id integer)" |     _sql = "create table test(id integer)" | ||||||
| 
 | 
 | ||||||
|  |     def test_open_with_bytes_path(self): | ||||||
|  |         path = os.fsencode(TESTFN) | ||||||
|  |         self.addCleanup(unlink, path) | ||||||
|  |         self.assertFalse(os.path.exists(path)) | ||||||
|  |         with contextlib.closing(sqlite.connect(path)) as cx: | ||||||
|  |             self.assertTrue(os.path.exists(path)) | ||||||
|  |             cx.execute(self._sql) | ||||||
|  | 
 | ||||||
|     def test_open_with_path_like_object(self): |     def test_open_with_path_like_object(self): | ||||||
|         """ Checks that we can successfully connect to a database using an object that |         """ Checks that we can successfully connect to a database using an object that | ||||||
|             is PathLike, i.e. has __fspath__(). """ |             is PathLike, i.e. has __fspath__(). """ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka