diff --git a/virtualizarr/tests/test_readers/test_dmrpp.py b/virtualizarr/tests/test_readers/test_dmrpp.py index cbafc40f..a6985d47 100644 --- a/virtualizarr/tests/test_readers/test_dmrpp.py +++ b/virtualizarr/tests/test_readers/test_dmrpp.py @@ -22,7 +22,7 @@ @pytest.fixture -def basic_dmrpp() -> DMRParser: +def basic_dmrpp_xml_str() -> str: xml_str = """\ @@ -111,11 +111,11 @@ def basic_dmrpp() -> DMRParser: """ - return DMRParser(root=ET.fromstring(textwrap.dedent(xml_str))) + return textwrap.dedent(xml_str) @pytest.fixture -def nested_groups_dmrpp() -> DMRParser: +def nested_groups_dmrpp_xml_str() -> str: xml_str = """\ @@ -166,7 +166,24 @@ def nested_groups_dmrpp() -> DMRParser: """ - return DMRParser(root=ET.fromstring(textwrap.dedent(xml_str))) + return textwrap.dedent(xml_str) + + +@pytest.fixture +def basic_dmrpp_temp_filepath(basic_dmrpp_xml_str, tmp_path) -> Path: + dmrpp_path = tmp_path / "basic.nc.dmrpp" + dmrpp_path.write_text(basic_dmrpp_xml_str) + return dmrpp_path + + +@pytest.fixture +def basic_dmrpp(basic_dmrpp_xml_str) -> DMRParser: + return DMRParser(root=ET.fromstring(basic_dmrpp_xml_str)) + + +@pytest.fixture +def nested_groups_dmrpp(nested_groups_dmrpp_xml_str) -> DMRParser: + return DMRParser(root=ET.fromstring(nested_groups_dmrpp_xml_str)) @network @@ -178,6 +195,13 @@ def test_NASA_dmrpp(data_url, dmrpp_url): xr.testing.assert_identical(result, expected) +def test_relative_path(basic_dmrpp_temp_filepath): + vds = open_virtual_dataset( + str(basic_dmrpp_temp_filepath), indexes={}, filetype="dmrpp" + ) + assert vds["x"].data.manifest["0"].path.endswith("basic.nc") + + @pytest.mark.parametrize( "dmrpp_fixture, fqn_path, expected_xpath", [