From 14c86ec38c4b73f91a53f5439cf8f0a7ac17fa45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Mon, 10 Apr 2017 17:24:39 +0200 Subject: [PATCH] Set plugin list as a @set and fixed test case It turns out setting "plugins" as a @list in the context causes the "plugins" property to expand to its full name. Removing the type causes a regression of #17, which I initially missed because the test in #17 was wrong. Closes #26 --- senpy/schemas/context.jsonld | 3 +++ tests/test_models.py | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/senpy/schemas/context.jsonld b/senpy/schemas/context.jsonld index 8ab7bfa..86d6c92 100644 --- a/senpy/schemas/context.jsonld +++ b/senpy/schemas/context.jsonld @@ -40,6 +40,9 @@ "options": { "@container": "@set" }, + "plugins": { + "@container": "@set" + }, "prov:wasGeneratedBy": { "@type": "@id" }, diff --git a/tests/test_models.py b/tests/test_models.py index 745a439..f667859 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -170,11 +170,10 @@ class ModelsTest(TestCase): def test_single_plugin(self): """A response with a single plugin should still return a list""" plugs = Plugins() - for i in range(10): - p = Plugin({'id': str(i), - 'version': 0, - 'description': 'dummy'}) - plugs.plugins.append(p) + p = Plugin({'id': str(0), + 'version': 0, + 'description': 'dummy'}) + plugs.plugins.append(p) assert isinstance(plugs.plugins, list) js = plugs.jsonld() assert isinstance(js['plugins'], list)