MCPcopy Index your code
hub / github.com/pydata/xarray / test_match

Method test_match

xarray/tests/test_datatree.py:1998–2019  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1996
1997class TestSubset:
1998 def test_match(self) -> None:
1999 # TODO is this example going to cause problems with case sensitivity?
2000 dt = DataTree.from_dict(
2001 {
2002 "/a/A": None,
2003 "/a/B": None,
2004 "/b/A": None,
2005 "/b/B": None,
2006 }
2007 )
2008 result = dt.match("*/B")
2009 expected = DataTree.from_dict(
2010 {
2011 "/a/B": None,
2012 "/b/B": None,
2013 }
2014 )
2015 assert_identical(result, expected)
2016
2017 result = dt.children["a"].match("B")
2018 expected = DataTree.from_dict({"/B": None}, name="a")
2019 assert_identical(result, expected)
2020
2021 def test_filter(self) -> None:
2022 simpsons = DataTree.from_dict(

Callers

nothing calls this directly

Calls 3

assert_identicalFunction · 0.90
from_dictMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected