From c1b0095b5a9b6b9dc3333274acb83c949892478f Mon Sep 17 00:00:00 2001 From: Kevin Velghe Date: Mon, 18 Nov 2024 11:28:28 +0100 Subject: [PATCH] remove checksum check in parquet tests --- tests/test_data/test.pq | Bin 0 -> 5176 bytes tests/test_io/test_parquet.py | 37 +++++++++++++--------------------- 2 files changed, 14 insertions(+), 23 deletions(-) create mode 100644 tests/test_data/test.pq diff --git a/tests/test_data/test.pq b/tests/test_data/test.pq new file mode 100644 index 0000000000000000000000000000000000000000..aaf4e6c801f50c89f23ebf1ca87de004a9d538ec GIT binary patch literal 5176 zcmcgwO>7(25#A-&6eZKLYIq4MAOaukg#*Xok4;4k93YQBA}v!4Nz44ZsN`}bQ(FFb zxzyh&ha7SUf*^+;atMkXf}$vjqUfRMDJX&<$SLS4=%FZrqKBM=B8MD0GjDgbqA5y1 z;1KfTzW3()zL|M5ZzY#lB_>Pql6<`&dt~97Ao#?y#2co^kH`I<`_ zeVPlA9PGY0V?hqcOQ|hN{6q-jHv){PNuP@tu(M4W>&ExQAYN_Rb5U2TSa^o-nnMIfYKb^$?AdR97sj ziPAnNQR0*WzX&8KzhpP@<=b=M%eK}s$Huf2%voC@`(e^^I|+U{U~@_VFnVh;0U_*= zxA++J+;+_-DXnBI|MYS~fZVH3wO&iU2@QA46S_RqhGw@j*d7?YTS6fWSiU|QYN~0B zdt2R(d);e{`|kOII?#2n><&&X`)#;wD}a{2JKE}K>flI_{V=^WQU`{{pMB5vTl(0V zc)=&W92gp!IyOcFW2<+}mlh4p)cUBmWp;ZOB7oE0pxxEG=8=%_ga9}&wQhe)??UN# zWMAO{M3#_35?|m!&S|>V12Wr54|pXRt^OY0w#wAn1=g#;y07(HeO24)w9FO|dkU{| z;`u%8Xp4f7;ZhFV5<*^Bv6(T|muUBd&EM0^*3YN8W@wnmZhvRXs;$w*{i1W=sSira z;pLxXMF`7*<%Hl{T0T`AvL`47-w}iFiOQ3kTr zm4o@cPkA4Hu{bM*w$!NxbinV zdg=n8rnj4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00001 diff --git a/tests/test_io/test_parquet.py b/tests/test_io/test_parquet.py index 247a04e..929c81d 100644 --- a/tests/test_io/test_parquet.py +++ b/tests/test_io/test_parquet.py @@ -1,6 +1,5 @@ """Tests for psm_utils.io.tsv.""" -import hashlib import os from psm_utils.io.parquet import ParquetReader, ParquetWriter @@ -32,40 +31,32 @@ ] -def compute_checksum(filename): - hash_func = hashlib.sha256() - with open(filename, "rb") as f: - for chunk in iter(lambda: f.read(4096), b""): - hash_func.update(chunk) - return hash_func.hexdigest() - - class TestParquetWriter: - expected_checksum = "1e5ee7afc5d4131bce8f1d0908136b8c559303abb7bbd7d052afa111d5e64f0c" - def test_write_psm(self): with ParquetWriter("test.pq") as writer: for test_case in test_cases: writer.write_psm(PSM(**test_case)) - actual_checksum = compute_checksum("test.pq") - assert actual_checksum == self.expected_checksum, "Checksums do not match" + + with ParquetReader("test.pq") as reader: + for i, psm in enumerate(reader): + assert psm == PSM(**test_cases[i]) + os.remove("test.pq") def test_write_file(self): with ParquetWriter("test.pq") as writer: writer.write_file(PSMList(psm_list=[PSM(**t) for t in test_cases])) - actual_checksum = compute_checksum("test.pq") - assert actual_checksum == self.expected_checksum, "Checksums do not match" - # os.remove("test.pq") + + with ParquetReader("test.pq") as reader: + for i, psm in enumerate(reader): + assert psm == PSM(**test_cases[i]) + + os.remove("test.pq") class TestParquetReader: def test_iter(self): - # Write test cases to file - ParquetWriter("test.pq").write_file(PSMList(psm_list=[PSM(**t) for t in test_cases])) - # Read test cases from file - for i, psm in enumerate(ParquetReader("test.pq")): - assert psm == PSM(**test_cases[i]) - - os.remove("test.pq") + with ParquetReader("tests/test_data/test.pq") as reader: + for i, psm in enumerate(reader): + assert psm == PSM(**test_cases[i])