From 9d09be14fed200ac29ae467294fb46f8f1cfcfd6 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 19 Jun 2024 23:35:28 -0400 Subject: added test cases for bzip compressed files --- tests/test_trace.py | 21 ++++++++++++++++++--- tests/trace_test_data/only_compressed_file2.dat.bz | Bin 0 -> 164 bytes .../trace_test_data/only_compressed_file3.dat.bz2 | Bin 0 -> 164 bytes tests/trace_test_data/xtrace1.dat.bz | Bin 0 -> 164 bytes tests/trace_test_data/xtrace1.dat.bz2 | Bin 0 -> 164 bytes 5 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 tests/trace_test_data/only_compressed_file2.dat.bz create mode 100644 tests/trace_test_data/only_compressed_file3.dat.bz2 create mode 100644 tests/trace_test_data/xtrace1.dat.bz create mode 100644 tests/trace_test_data/xtrace1.dat.bz2 (limited to 'tests') diff --git a/tests/test_trace.py b/tests/test_trace.py index 24c96c5..65a9f5b 100644 --- a/tests/test_trace.py +++ b/tests/test_trace.py @@ -18,9 +18,26 @@ def test_load_gzip_compressed_v0dot1_trace(): tr = loadTrace('tests/trace_test_data/xtrace1.dat.gz') assert isItExpectedTrace(tr) == True +def test_load_bzip_compressed_v0dot1_trace(): + tr = loadTrace('tests/trace_test_data/xtrace1.dat.bz') + assert isItExpectedTrace(tr) == True + + tr = loadTrace('tests/trace_test_data/xtrace1.dat.bz2') + assert isItExpectedTrace(tr) == True + def test_tryCompressedIfMissing(): fname = 'tests/trace_test_data/only_compressed_file1.dat' - # first we check that the guess is working + # we check that the guess is working for gzip compressed file (.gz) + tr = loadTrace(fname, tryCompressedIfMissing=True) + assert isItExpectedTrace(tr) == True + + fname = 'tests/trace_test_data/only_compressed_file2.dat' + # we check that the guess is working for bzip compressed file (.bz) + tr = loadTrace(fname, tryCompressedIfMissing=True) + assert isItExpectedTrace(tr) == True + + fname = 'tests/trace_test_data/only_compressed_file3.dat' + # we check that the guess is working for bzip compressed file (.bz2) tr = loadTrace(fname, tryCompressedIfMissing=True) assert isItExpectedTrace(tr) == True @@ -28,5 +45,3 @@ def test_tryCompressedIfMissing(): with pytest.raises(FileNotFoundError) as exc_info: tr = loadTrace(fname, tryCompressedIfMissing=False) - - diff --git a/tests/trace_test_data/only_compressed_file2.dat.bz b/tests/trace_test_data/only_compressed_file2.dat.bz new file mode 100644 index 0000000..84a980c Binary files /dev/null and b/tests/trace_test_data/only_compressed_file2.dat.bz differ diff --git a/tests/trace_test_data/only_compressed_file3.dat.bz2 b/tests/trace_test_data/only_compressed_file3.dat.bz2 new file mode 100644 index 0000000..84a980c Binary files /dev/null and b/tests/trace_test_data/only_compressed_file3.dat.bz2 differ diff --git a/tests/trace_test_data/xtrace1.dat.bz b/tests/trace_test_data/xtrace1.dat.bz new file mode 100644 index 0000000..84a980c Binary files /dev/null and b/tests/trace_test_data/xtrace1.dat.bz differ diff --git a/tests/trace_test_data/xtrace1.dat.bz2 b/tests/trace_test_data/xtrace1.dat.bz2 new file mode 100644 index 0000000..84a980c Binary files /dev/null and b/tests/trace_test_data/xtrace1.dat.bz2 differ -- cgit v1.2.3