2017-10-23 20:26:42 +08:00
|
|
|
import pytest
|
|
|
|
|
2017-10-24 00:49:49 +08:00
|
|
|
from _pytest import nodes
|
2017-10-23 20:26:42 +08:00
|
|
|
|
|
|
|
|
2018-05-23 22:48:46 +08:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"baseid, nodeid, expected",
|
|
|
|
(
|
|
|
|
("", "", True),
|
|
|
|
("", "foo", True),
|
|
|
|
("", "foo/bar", True),
|
|
|
|
("", "foo/bar::TestBaz::()", True),
|
|
|
|
("foo", "food", False),
|
|
|
|
("foo/bar::TestBaz::()", "foo/bar", False),
|
|
|
|
("foo/bar::TestBaz::()", "foo/bar::TestBop::()", False),
|
|
|
|
("foo/bar", "foo/bar::TestBop::()", True),
|
|
|
|
),
|
|
|
|
)
|
2017-10-24 00:49:49 +08:00
|
|
|
def test_ischildnode(baseid, nodeid, expected):
|
|
|
|
result = nodes.ischildnode(baseid, nodeid)
|
2017-10-23 20:26:42 +08:00
|
|
|
assert result is expected
|