|
2 | 2 | import pathlib |
3 | 3 | from dataclasses import dataclass |
4 | 4 |
|
5 | | -import numpy as np |
6 | 5 | import pytest |
7 | 6 | import yaml |
8 | 7 |
|
@@ -199,25 +198,13 @@ def from_parent( |
199 | 198 |
|
200 | 199 | def runtest(self): |
201 | 200 | import asdf |
202 | | - from asdf import _block, generic_io |
203 | | - from asdf.testing import helpers |
| 201 | + from asdf.testing.helpers import yaml_to_asdf |
204 | 202 |
|
205 | | - # Make sure that the examples in the schema files (and thus the |
206 | | - # ASDF standard document) are valid. |
207 | | - buff = helpers.yaml_to_asdf("example: " + self.example.example.strip(), version=self.example.version) |
208 | | - |
209 | | - # add a few blocks |
210 | | - # make a block and write it out to the above generated buffer/example |
211 | | - wb = _block.writer.WriteBlock(np.zeros(1024 * 1024 * 8, dtype=np.uint8)) |
212 | | - with generic_io.get_file(buff, mode="rw") as f: |
213 | | - f.seek(0, 2) |
214 | | - _block.writer.write_blocks(f, [wb, wb], streamed_block=wb) |
215 | | - f.seek(0) |
216 | | - |
217 | | - af = asdf.loads(buff.getvalue()) |
218 | | - |
219 | | - if b"external.asdf" not in buff.getvalue(): |
220 | | - asdf.dumps(af) |
| 203 | + # check the example is valid |
| 204 | + buff = yaml_to_asdf("example: " + self.example.example.strip(), version=self.example.version) |
| 205 | + tagged_tree = asdf.util.load_yaml(buff, tagged=True) |
| 206 | + instance = asdf.AsdfFile(version=self.example.version) |
| 207 | + asdf.schema.validate(tagged_tree, instance, reading=True) |
221 | 208 |
|
222 | 209 | def reportinfo(self): |
223 | 210 | return self.fspath, 0, "" |
|
0 commit comments