-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #988 from eslavich/AL-524-asdftool-new-extension-api
Update asdftool tags and asdftool extensions for new extension API
- Loading branch information
Showing
5 changed files
with
96 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pytest | ||
|
||
from .. import find_extensions | ||
|
||
|
||
@pytest.mark.parametrize("summary", [True, False]) | ||
@pytest.mark.parametrize("tags_only", [True, False]) | ||
def test_parameter_combinations(summary, tags_only): | ||
# Just confirming no errors: | ||
find_extensions(summary, tags_only) | ||
|
||
|
||
def test_builtin_extension_included(capsys): | ||
find_extensions(True, False) | ||
captured = capsys.readouterr() | ||
assert "asdf.extension.BuiltinExtension" in captured.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,25 @@ | ||
import io | ||
|
||
import pytest | ||
|
||
from ... import AsdfFile | ||
from .. import list_tags | ||
|
||
def _get_tags(display_classes): | ||
iostream = io.StringIO() | ||
list_tags(display_classes=display_classes, iostream=iostream) | ||
iostream.seek(0) | ||
return [line.strip() for line in iostream.readlines()] | ||
|
||
def _class_to_string(_class): | ||
return "{}.{}".format(_class.__module__, _class.__name__) | ||
|
||
def test_list_schemas(): | ||
obs_tags = _get_tags(False) | ||
|
||
af = AsdfFile() | ||
exp_tags = sorted(af.type_index._type_by_tag.keys()) | ||
@pytest.mark.parametrize("display_classes", [True, False]) | ||
def test_parameter_combinations(display_classes): | ||
# Just confirming no errors: | ||
list_tags(display_classes) | ||
|
||
for exp, obs in zip(exp_tags, obs_tags): | ||
assert exp == obs | ||
|
||
def test_list_schemas_and_tags(): | ||
tag_lines = _get_tags(True) | ||
def test_all_tags_present(): | ||
iostream = io.StringIO() | ||
list_tags(iostream=iostream) | ||
iostream.seek(0) | ||
tags = {line.strip() for line in iostream.readlines()} | ||
|
||
af = AsdfFile() | ||
type_by_tag = af.type_index._type_by_tag | ||
exp_tags = sorted(type_by_tag.keys()) | ||
|
||
for exp_tag, line in zip(exp_tags, tag_lines): | ||
tag_name, tag_class = line.split(": ") | ||
assert tag_name == exp_tag | ||
|
||
exp_class = _class_to_string(type_by_tag[exp_tag]) | ||
assert tag_class == exp_class | ||
for tag in af.type_index._type_by_tag: | ||
assert tag in tags | ||
for tag in af.extension_manager._tag_defs_by_tag: | ||
assert tag in tags |