From 250052fb99fdf747df5737294457919d9313c04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Tue, 14 Mar 2017 13:17:09 +0100 Subject: [PATCH] Options as a set in the JSON-LD context Closes #18 --- senpy/schemas/context.jsonld | 3 +++ tests/test_models.py | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/senpy/schemas/context.jsonld b/senpy/schemas/context.jsonld index a171639..4b77adb 100644 --- a/senpy/schemas/context.jsonld +++ b/senpy/schemas/context.jsonld @@ -40,6 +40,9 @@ "plugins": { "@container": "@list" }, + "options": { + "@container": "@set" + }, "prov:wasGeneratedBy": { "@type": "@id" }, diff --git a/tests/test_models.py b/tests/test_models.py index 25c53e5..3f0d736 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -97,7 +97,15 @@ class ModelsTest(TestCase): def test_plugins(self): self.assertRaises(Error, plugins.Plugin) - p = plugins.Plugin({"name": "dummy", "version": 0}) + p = plugins.Plugin({"name": "dummy", + "version": 0, + "extra_params": { + "none": { + "options": ["es", ], + "required": False, + "default": "0" + } + }}) c = p.jsonld() assert "info" not in c assert "repo" not in c @@ -105,6 +113,8 @@ class ModelsTest(TestCase): logging.debug("Framed:") logging.debug(c) p.validate() + assert "es" in c['extra_params']['none']['options'] + assert isinstance(c['extra_params']['none']['options'], list) def test_str(self): """The string representation shouldn't include private variables"""