|
| 1 | +from pathlib import Path |
| 2 | +from typing import Any, Dict, List, cast |
| 3 | + |
| 4 | +from schema_salad import schema |
| 5 | +from .util import get_data_uri |
| 6 | + |
| 7 | +cwl_file_uri = get_data_uri("tests/test_schema/CommonWorkflowLanguage.yml") |
| 8 | + |
| 9 | + |
| 10 | +def test_extend_and_specialize_enums(tmp_path: Path) -> None: |
| 11 | + document_loader, _, _, metaschema_loader = schema.load_schema(cwl_file_uri) |
| 12 | + schema_raw_doc = metaschema_loader.fetch(cwl_file_uri) |
| 13 | + schema_doc, _ = metaschema_loader.resolve_all(schema_raw_doc, cwl_file_uri) |
| 14 | + |
| 15 | + j = schema.extend_and_specialize( |
| 16 | + cast(List[Dict[str, Any]], schema_doc), document_loader |
| 17 | + ) |
| 18 | + CWLType = next( |
| 19 | + (x for x in j if x["name"] == "https://w3id.org/cwl/cwl#CWLType"), None |
| 20 | + ) |
| 21 | + assert CWLType is not None |
| 22 | + symbols = [ |
| 23 | + "https://w3id.org/cwl/salad#null", |
| 24 | + "http://www.w3.org/2001/XMLSchema#boolean", |
| 25 | + "http://www.w3.org/2001/XMLSchema#int", |
| 26 | + "http://www.w3.org/2001/XMLSchema#long", |
| 27 | + "http://www.w3.org/2001/XMLSchema#float", |
| 28 | + "http://www.w3.org/2001/XMLSchema#double", |
| 29 | + "http://www.w3.org/2001/XMLSchema#string", |
| 30 | + "https://w3id.org/cwl/cwl#File", |
| 31 | + "https://w3id.org/cwl/cwl#Directory", |
| 32 | + ] |
| 33 | + for symbol in symbols: |
| 34 | + assert symbol in CWLType["symbols"] |
0 commit comments