Skip to content

Commit

Permalink
Added dlis and lis error files
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroKpaxo committed Sep 19, 2024
1 parent 993bb35 commit b110fc2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
12 changes: 11 additions & 1 deletion test/dlis/test_dlis_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

folder_path = Path(__file__).parent.parent / 'test_files'
file_path = folder_path / '1PIR1AL_conv_ccl_canhoneio.dlis'
error_file_path = folder_path / '1PIR1AL_conv_ccl_canhoneio-error.dlis'


def test_search_files():
dlis_processor = DlisReader()
dlis_files = dlis_processor.search_files(folder_path)
assert len(dlis_files) == 1
assert len(dlis_files) == 2
assert dlis_files[0].name == '1PIR1AL_conv_ccl_canhoneio.dlis'

# Testing the search_files method with a wrong path
Expand All @@ -25,6 +26,15 @@ def test_read_dlis_file():
assert physical_file.file_name == '1PIR1AL_conv_ccl_canhoneio.dlis'


def test_read_dlis_file_error():
dlis_processor = DlisReader()
physical_file = dlis_processor.process_physical_file(error_file_path)
assert physical_file.error
assert physical_file.error_message is not None
assert physical_file.file_name == '1PIR1AL_conv_ccl_canhoneio-error.dlis'
assert physical_file.logical_files_count == 0


def test_raw_read():
dlis_processor = DlisReader()
raw = dlis_processor.load_raw(file_path)
Expand Down
14 changes: 12 additions & 2 deletions test/lis/test_lis_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

folder_path = Path(__file__).parent.parent / 'test_files'
file_path = f'{folder_path}/1-MPE-3-AL.lis'
error_file_path = folder_path / '1-MPE-3-AL-error.lis'


def test_search_files():
lis_processor = LisReader()
lis_files = lis_processor.search_files(folder_path)
assert len(lis_files) == 1
assert lis_files[0].name == '1-MPE-3-AL.lis'
assert len(lis_files) == 2
assert '1-MPE-3-AL.lis' in [file.name for file in lis_files]


def test_lis_reading():
Expand All @@ -23,6 +24,15 @@ def test_lis_reading():
assert file.error is False


def test_lis_reading_error():
reader = LisReader()
file = reader.process_physical_file(error_file_path)
assert file.error
assert file.error_message is not None
assert file.file_name == '1-MPE-3-AL-error.lis'
assert file.logical_files_count == 0


def test_raw_reading():
reader = LisReader()
raw = reader.load_raw(file_path)
Expand Down
Binary file added test/test_files/1-MPE-3-AL-error.lis
Binary file not shown.
Binary file not shown.

0 comments on commit b110fc2

Please sign in to comment.