Skip to content

Commit

Permalink
add tests for base RasHdf class
Browse files Browse the repository at this point in the history
  • Loading branch information
thwllms committed Jul 23, 2024
1 parent 9c117a8 commit 6969629
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from src.rashdf.base import RasHdf
from unittest.mock import patch


def test_open():
rasfile = "Muncie.g05.hdf"
rasfile_path = f"./tests/data/ras/{rasfile}"
hdf = RasHdf(rasfile_path)
assert hdf._loc == rasfile_path


def test_open_uri():
rasfile = "Muncie.g05.hdf"
rasfile_path = f"./tests/data/ras/{rasfile}"
url = f"s3://mybucket/{rasfile}"

# Mock the specific functions used by s3fs
with patch("s3fs.core.S3FileSystem.open", return_value=open(rasfile_path, "rb")):
hdf = RasHdf.open_uri(url)
assert hdf._loc == url

0 comments on commit 6969629

Please sign in to comment.