Skip to content

Commit ae9b463

Browse files
committed
A couple of bonus tests, just for fun!
1 parent 2389be2 commit ae9b463

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test_utils/test_schemaview.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,8 @@ def test_in_schema(schema_view_with_imports: SchemaView) -> None:
784784
assert view.in_schema(SlotDefinitionName("name")) == "core"
785785
assert view.in_schema(SlotDefinitionName(ACTIVITY)) == "core"
786786
assert view.in_schema(SlotDefinitionName("string")) == "types"
787+
with pytest.raises(ValueError, match="Element fake_element not in any schema"):
788+
view.in_schema("fake_element")
787789

788790

789791
CREATURE_EXPECTED = {
@@ -1158,6 +1160,12 @@ def test_all_classes_ordered_by(sv_ordering_tests: SchemaView, ordered_by: str)
11581160
assert list(sv_ordering_tests.all_classes(ordered_by=ordered_by).keys()) == ORDERING_TESTS[ordered_by]
11591161

11601162

1163+
def test_all_classes_ordered_by_error(sv_ordering_tests: SchemaView) -> None:
1164+
"""Test the ordered_by method throws an error when appropriate."""
1165+
with pytest.raises(ValueError, match="ordered_by must be in OrderedBy or None, got whatever"):
1166+
sv_ordering_tests.all_classes(ordered_by="whatever")
1167+
1168+
11611169
def test_all_classes_class_induced_slots(schema_view_with_imports: SchemaView) -> None:
11621170
"""Test all_classes and class_induced_slots."""
11631171
view = schema_view_with_imports

0 commit comments

Comments
 (0)