From 5bb37c3c1b4a3f352e9dec7f65bad000d7108dd8 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 25 Jan 2023 10:10:36 -0500 Subject: [PATCH] Fix docstrings & add an additional test (#654) * Fix docstrings & add an additional test --- schema_salad/tests/test_errors.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/schema_salad/tests/test_errors.py b/schema_salad/tests/test_errors.py index a86fcd1f..5faadee1 100644 --- a/schema_salad/tests/test_errors.py +++ b/schema_salad/tests/test_errors.py @@ -382,7 +382,7 @@ def test_namespaces_undeclared(caplog: pytest.LogCaptureFixture) -> None: def test_not_a_namespace1(caplog: pytest.LogCaptureFixture) -> None: - """Confirm warning message a namespace is used but not declared.""" + """Confirm no warning when relative id contains a colon but prefix doesn't look like a namespace.""" ldr, _, _, _ = schema_salad.schema.load_schema( cmap( @@ -404,7 +404,7 @@ def test_not_a_namespace1(caplog: pytest.LogCaptureFixture) -> None: def test_not_a_namespace2(caplog: pytest.LogCaptureFixture) -> None: - """Confirm warning message a namespace is used but not declared.""" + """Confirm no warning when relative id contains a colon but prefix doesn't look like a namespace.""" ldr, _, _, _ = schema_salad.schema.load_schema( cmap( @@ -425,6 +425,28 @@ def test_not_a_namespace2(caplog: pytest.LogCaptureFixture) -> None: assert caplog.text == "" +def test_not_a_namespace3(caplog: pytest.LogCaptureFixture) -> None: + """Confirm no warning when relative id starts with a colon.""" + + ldr, _, _, _ = schema_salad.schema.load_schema( + cmap( + { + "$base": "Y", + "name": "X", + "$graph": [ + { + "name": ":ExampleType", + "type": "enum", + "symbols": ["asym", "bsym"], + } + ], + } + ) + ) + + assert caplog.text == "" + + def test_schemas_type() -> None: """Confirm helpful error message when $schemas is the wrong type.""" path = get_data("tests/EDAM.owl")