# HG changeset patch # User Henry S. Thompson # Date 1688581922 -3600 # Node ID 212da3fe3b199d56c15793567b8051f330141e48 # Parent 083229195d129e6263b4e7ebea1da81df1a1376b make test 1 idempotent diff -r 083229195d12 -r 212da3fe3b19 bin/test_warc.py --- a/bin/test_warc.py Wed Jul 05 17:51:44 2023 +0100 +++ b/bin/test_warc.py Wed Jul 05 19:32:02 2023 +0100 @@ -6,12 +6,18 @@ sys.argv.pop(1) def showme(wtype,buf,part): + # This should exactly reproduce a complete warc file if called + # as per version 1 below if debug: - breakpoint() - OUT.write(b"%d\n%b"%(part,buf)) - + OUT.write(b"%d\n%b"%(part,buf)) + else: + OUT.write(buf) + if buf[-1]!=b'\n': + OUT.write(b'\r\n') + if part==7: + OUT.write(b'\r\n') # to match complete file formatting -#warc(showme,[b'response','warcinfo','request','metadata'],int(sys.argv[2])) -#warc(showme,[b'response'],whole=True) +# 1 warc.warc(sys.argv[1],showme,[b'response','warcinfo','request','metadata'],whole=True) +# 2 warc.warc(sys.argv[1],showme,[b'response'],parts=int(sys.argv[2]),debug=debug)