From 8df78f280ea4d848a7462167f6e669e5406769f9 Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Tue, 24 Oct 2023 14:37:16 -0700 Subject: [PATCH] add an additional example that is os-independent --- src/pyhf/schema/loader.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pyhf/schema/loader.py b/src/pyhf/schema/loader.py index 920766c4dc..0562af0960 100644 --- a/src/pyhf/schema/loader.py +++ b/src/pyhf/schema/loader.py @@ -19,7 +19,7 @@ def load_schema(schema_id: str): Args: schema_id (str): Relative path to schema from :attr:`pyhf.schema.path` - Example: + Examples: >>> import pyhf >>> schema = pyhf.schema.load_schema("1.0.0/defs.json") >>> type(schema) @@ -31,6 +31,18 @@ def load_schema(schema_id: str): ... pyhf.exceptions.SchemaNotFound: ... + >>> import pyhf + >>> import os + >>> schema = pyhf.schema.load_schema(f"1.0.0{os.sep}defs.json") + >>> type(schema) + + >>> schema.keys() + dict_keys(['$schema', '$id', 'definitions']) + >>> pyhf.schema.load_schema(f"0.0.0{os.sep}defs.json") # doctest: +ELLIPSIS + Traceback (most recent call last): + ... + pyhf.exceptions.SchemaNotFound: ... + Returns: schema (dict): The loaded schema.