Skip to content

Commit 3262691

Browse files
committed
Test raises when term doesn't exist for compacted input
1 parent 5512f7e commit 3262691

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

test/hermes_test/model/types/test_ld_context.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,27 @@ def test_get_item_from_prefixed_vocabulary_raises_on_prefix_not_exist(ctx, not_e
8888
)
8989

9090

91-
def test_get_protocol_items_fail(ctx):
92-
with pytest.raises(Exception) as e:
93-
ctx["https://foo.bar/baz"]
94-
assert "cannot access local variable" not in str(e.value) # FIXME: Replace with custom error
91+
@pytest.mark.parametrize(
92+
"not_exist",
93+
[
94+
"baz",
95+
"hermes:baz",
96+
"schema:baz",
97+
(None, "baz"),
98+
("hermes", "baz"),
99+
("schema", "baz"),
100+
],
101+
)
102+
def test_get_item_item_from_prefixed_vocabulary_raises_on_term_not_exist(ctx, not_exist):
103+
"""
104+
Tests that an exception is raised when trying to get compacted items for which the vocabulary exists,
105+
but doesn't contain the requested term, and that the raised exception is not raised due to side effects.
106+
"""
107+
with pytest.raises(Exception) as e: # FIXME: Replace with custom error
108+
ctx[not_exist]
109+
assert "cannot access local variable" not in str(
110+
e.value
111+
)
95112

96113

97114
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)