Skip to content

Commit

Permalink
add dedent() to pytest fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushnag committed Nov 7, 2024
1 parent 3040eeb commit 72cecc2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions virtualizarr/tests/test_readers/test_dmrpp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import textwrap
from pathlib import Path
from xml.etree import ElementTree as ET

Expand All @@ -22,7 +23,8 @@

@pytest.fixture
def basic_dmrpp() -> DMRParser:
xml_str = """<?xml version="1.0" encoding="ISO-8859-1"?>
xml_str = """\
<?xml version="1.0" encoding="ISO-8859-1"?>
<Dataset xmlns="http://xml.opendap.org/ns/DAP/4.0#" xmlns:dmrpp="http://xml.opendap.org/dap/dmrpp/1.0.0#" dapVersion="4.0" dmrVersion="1.0" name="test.dmrpp">
<Dimension name="x" size="720"/>
<Dimension name="y" size="1440"/>
Expand Down Expand Up @@ -109,12 +111,13 @@ def basic_dmrpp() -> DMRParser:
</Attribute>
</Dataset>
"""
return DMRParser(root=ET.fromstring(xml_str))
return DMRParser(root=ET.fromstring(textwrap.dedent(xml_str)))


@pytest.fixture
def nested_groups_dmrpp() -> DMRParser:
xml_str = """<?xml version="1.0" encoding="ISO-8859-1"?>
xml_str = """\
<?xml version="1.0" encoding="ISO-8859-1"?>
<Dataset xmlns="http://xml.opendap.org/ns/DAP/4.0#" xmlns:dmrpp="http://xml.opendap.org/dap/dmrpp/1.0.0#" dapVersion="4.0" dmrVersion="1.0" name="test.dmrpp">
<Dimension name="a" size="10"/>
<Dimension name="b" size="10"/>
Expand Down Expand Up @@ -163,7 +166,7 @@ def nested_groups_dmrpp() -> DMRParser:
</Group>
</Dataset>
"""
return DMRParser(root=ET.fromstring(xml_str))
return DMRParser(root=ET.fromstring(textwrap.dedent(xml_str)))


@network
Expand Down

0 comments on commit 72cecc2

Please sign in to comment.