Skip to content

Commit

Permalink
Added better tests for ek80 checker functions.
Browse files Browse the repository at this point in the history
Added better tests for ek80 checker functions.
  • Loading branch information
spacetimeengineer committed Oct 31, 2024
1 parent 907424d commit 8a2517d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
3 changes: 3 additions & 0 deletions echopype/tests/convert/test_convert_ek60.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def test_converting_ek60_raw_with_missing_channel_power():


def test_is_EK60_ek60_files():
"""Check that EK60 files are identified as EK60"""
# Collect all .raw files in the ek60 directory
ek60_files = glob.glob("echopype/test_data/ek60/*.raw")

Expand All @@ -275,6 +276,7 @@ def test_is_EK60_ek60_files():
assert is_EK60(test_file_path, storage_options={}) == True

def test_is_EK60_er60_files():
"""Check that ER60 files are identified as EK60"""
# Collect all .raw files in the ek60 directory (assuming ER60 files are also here)
er60_files = glob.glob("echopype/test_data/ek60/*.raw")

Expand All @@ -283,6 +285,7 @@ def test_is_EK60_er60_files():
assert is_EK60(test_file_path, storage_options={}) == True

def test_is_EK60_non_ek60_files():
"""Check that non-EK60 files are not identified as EK60"""
# Collect all .raw files in the ek80 directory (non-EK60 files)
ek80_files = glob.glob("echopype/test_data/ek80/*.raw")

Expand Down
28 changes: 18 additions & 10 deletions echopype/tests/convert/test_convert_ek80.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import shutil

import glob
import pytest
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -532,12 +532,20 @@ def test_parse_ek80_with_invalid_env_datagrams():
assert env_var.notnull().all() and env_var.dtype == np.float64


def test_is_EK80_ek80_file():
# Replace with the path to a valid EK80 test file that includes "configuration"
test_file_path = "echopype/test_data/ek80/D20170912-T234910.raw"
assert is_EK80(test_file_path, storage_options={}) == True

def test_is_EK80_non_ek80_file():
# Replace with the path to a test file without "configuration" key
test_file_path = "echopype/test_data/ek60/L0003-D20040909-T161906-EK60.raw"
assert is_EK80(test_file_path, storage_options={}) == False
def test_is_EK80_ek80_files():
"""Test that EK80 files are identified as EK80."""
# Collect all .raw files in the ek80 directory
ek80_files = glob.glob("echopype/test_data/ek80/*.raw")

# Check that each file in ek80 is identified as EK80
for test_file_path in ek80_files:
assert is_EK80(test_file_path, storage_options={}) == True

def test_is_EK80_non_ek80_files():
"""Test that non-EK80 files are not identified as EK80."""
# Collect all .raw files in the ek60 directory (non-EK80 files)
ek60_files = glob.glob("echopype/test_data/ek60/*.raw")

# Check that each file in ek60 is not identified as EK80
for test_file_path in ek60_files:
assert is_EK80(test_file_path, storage_options={}) == False

0 comments on commit 8a2517d

Please sign in to comment.