File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -415,6 +415,29 @@ def test_DeterministicGzipFile():
415
415
assert md5sum ("filenameA.gz" ) == anon_chksum
416
416
417
417
418
+ def test_DeterministicGzipFile_fileobj ():
419
+ with InTemporaryDirectory ():
420
+ msg = b"Hello, I'd like to have an argument."
421
+ with open ("ref.gz" , "wb" ) as fobj :
422
+ with GzipFile (filename = "" , mode = "wb" , fileobj = fobj , mtime = 0 ) as gzobj :
423
+ gzobj .write (msg )
424
+ ref_chksum = md5sum ("ref.gz" )
425
+
426
+ with open ("test.gz" , "wb" ) as fobj :
427
+ with DeterministicGzipFile (filename = "" , mode = "wb" , fileobj = fobj ) as gzobj :
428
+ gzobj .write (msg )
429
+ md5sum ("test.gz" ) == ref_chksum
430
+
431
+ with open ("test.gz" , "wb" ) as fobj :
432
+ with DeterministicGzipFile (fileobj = fobj , mode = "wb" ) as gzobj :
433
+ gzobj .write (msg )
434
+ md5sum ("test.gz" ) == ref_chksum
435
+
436
+ with open ("test.gz" , "wb" ) as fobj :
437
+ with DeterministicGzipFile (filename = "test.gz" , mode = "wb" , fileobj = fobj ) as gzobj :
438
+ gzobj .write (msg )
439
+ md5sum ("test.gz" ) == ref_chksum
440
+
418
441
419
442
def test_bitwise_determinism ():
420
443
with InTemporaryDirectory ():
You can’t perform that action at this time.
0 commit comments