1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-08-24 02:22:20 +00:00

Added random plugin and other features

This commit is contained in:
J. Fernando Sánchez
2015-02-23 02:13:31 +01:00
parent 37a098109f
commit 79c83e34a3
17 changed files with 329 additions and 101 deletions

View File

@@ -0,0 +1,36 @@
import os
import logging
try:
import unittest.mock as mock
except ImportError:
import mock
import json
import os
from unittest import TestCase
from senpy.models import Response
from senpy.plugins import SenpyPlugin
class ModelsTest(TestCase):
def test_response(self):
r = Response(context=os.path.normpath(os.path.join(__file__, "..", "..", "context.jsonld")))
assert("@context" in r)
assert("marl" in r.context)
r2 = Response(context=json.loads('{"test": "roger"}'))
assert("test" in r2.context)
r3 = Response(context=None)
del r3.context
assert("@context" not in r3)
assert("entries" in r3)
assert("analysis" in r3)
def test_opinions(self):
pass
def test_frame_plugin(self):
p = SenpyPlugin({"name": "dummy", "version": 0})
c = p.frame()
assert "info" not in c
def test_frame_response(self):
pass