schema_salad.tests.test_runtime
===============================

.. py:module:: schema_salad.tests.test_runtime

.. autoapi-nested-parse::

   Test the runtime module.



Attributes
----------

.. autoapisummary::

   schema_salad.tests.test_runtime.BASE


Functions
---------

.. autoapisummary::

   schema_salad.tests.test_runtime.test_save_relative_uri_sibling_prefix
   schema_salad.tests.test_runtime.test_save_relative_uri_sibling_prefix_ref_scope_1
   schema_salad.tests.test_runtime.test_save_relative_uri_sibling
   schema_salad.tests.test_runtime.test_save_relative_uri_inside_scope
   schema_salad.tests.test_runtime.test_save_relative_uri_packed
   schema_salad.tests.test_runtime.test_save_relative_uri_scope_is_document_root
   schema_salad.tests.test_runtime.test_save_relative_uri_no_ref_scope
   schema_salad.tests.test_runtime.test_save_relative_uri_round_trip


Module Contents
---------------

.. py:data:: BASE
   :value: 'file:///wf.cwl#second_step/input_2'


.. py:function:: test_save_relative_uri_sibling_prefix()

   A sibling id sharing a name prefix with the scope must not be truncated.

   E.g. in CWL, a step input sourced from a workflow input whose name
   starts with the step's own name:

       inputs:
         second_step_input: string        # id: ...#second_step_input
       steps:
         second_step:
           in:
             input_2: second_step_input   # id: ...#second_step/input_2

   Saving the `source` field (ref_scope=2) must yield "second_step_input",
   not "_input".


.. py:function:: test_save_relative_uri_sibling_prefix_ref_scope_1()

   Same as above for ref_scope=1 fields, e.g. a CWL Workflow outputSource.

       outputs:
         second:                          # id: ...#second
           outputSource: second_step/log

   must save as "second_step/log", not "_step/log".


.. py:function:: test_save_relative_uri_sibling()

   An ordinary sibling reference is saved as its full fragment.

   E.g. CWL's `source: first_input` or `source: first_step/log`.


.. py:function:: test_save_relative_uri_inside_scope()

   A reference is relativized against the scope the loader resolves it in.

   For a ref_scope=2 field on "#second_step/input_2" that scope is the
   document root, so a step output keeps its step name.


.. py:function:: test_save_relative_uri_packed()

   In a packed document, only the enclosing process's name is stripped.

   E.g. `source: inp` on step input "#main/step/in" (ref_scope=2) and
   `outputSource: step/log` on workflow output "#main/out" (ref_scope=1).


.. py:function:: test_save_relative_uri_scope_is_document_root()

   When ref_scope pops every fragment segment, the full fragment is kept.

   E.g. a ref_scope=2 field whose own id is a single top-level fragment.


.. py:function:: test_save_relative_uri_no_ref_scope()

   Without ref_scope the base fragment already ends in a slash.

   E.g. how CWL's `scatter: input_2` is saved relative to its step.


.. py:function:: test_save_relative_uri_round_trip(uri, base, ref_scope)

   Loading a saved scoped reference gives back the original URI.


