Skip to content

Commit

Permalink
test: add check schema test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ketozhang committed Aug 26, 2024
1 parent 3ce3401 commit cb4387c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/examples/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ class TestExtension(Extension):
yield asdf_config


@pytest.mark.usefixtures("asdf_extension")
def test_check_schema():
"""Tests the model schema is correct."""
schema = yaml.safe_load(AsdfNode.model_asdf_schema())
asdf.schema.check_schema(schema)


@pytest.mark.usefixtures("asdf_extension")
def test_can_write_valid_asdf_file(tmp_path):
"""Tests using the model to write an ASDF file validates its own schema."""
Expand Down
8 changes: 8 additions & 0 deletions tests/examples/test_rectangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import MagicMock, patch

import asdf
import asdf.schema
import pytest
import yaml
from asdf.extension import Extension
Expand Down Expand Up @@ -38,6 +39,13 @@ class TestExtension(Extension):
yield asdf_config


@pytest.mark.usefixtures("asdf_extension")
def test_check_schema():
"""Tests the model schema is correct."""
schema = yaml.safe_load(AsdfRectangle.model_asdf_schema())
asdf.schema.check_schema(schema)


@pytest.mark.usefixtures("asdf_extension")
def test_can_write_valid_asdf_file(tmp_path):
"""Tests using the model to write an ASDF file validates its own schema."""
Expand Down

0 comments on commit cb4387c

Please sign in to comment.