mirror of
https://github.com/gsi-upm/senpy
synced 2024-11-24 17:12:29 +00:00
Log easy and test serializable
This commit is contained in:
parent
23c88d0acc
commit
d29c42fd2e
@ -71,8 +71,9 @@ def easy_test(plugin_list=None):
|
|||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
logging.getLogger().setLevel(logging.INFO)
|
logging.getLogger().setLevel(logging.INFO)
|
||||||
if not plugin_list:
|
if not plugin_list:
|
||||||
from . import plugins
|
|
||||||
import __main__
|
import __main__
|
||||||
|
logger.info('Loading classes from {}'.format(__main__))
|
||||||
|
from . import plugins
|
||||||
plugin_list = plugins.from_module(__main__)
|
plugin_list = plugins.from_module(__main__)
|
||||||
for plug in plugin_list:
|
for plug in plugin_list:
|
||||||
plug.test()
|
plug.test()
|
||||||
|
@ -9,6 +9,7 @@ from senpy.models import (Emotion,
|
|||||||
EmotionAnalysis,
|
EmotionAnalysis,
|
||||||
EmotionSet,
|
EmotionSet,
|
||||||
Entry,
|
Entry,
|
||||||
|
Entity,
|
||||||
Error,
|
Error,
|
||||||
Results,
|
Results,
|
||||||
Sentiment,
|
Sentiment,
|
||||||
@ -207,3 +208,14 @@ class ModelsTest(TestCase):
|
|||||||
recovered = from_string(string)
|
recovered = from_string(string)
|
||||||
assert isinstance(recovered, Results)
|
assert isinstance(recovered, Results)
|
||||||
assert isinstance(recovered.entries[0], Entry)
|
assert isinstance(recovered.entries[0], Entry)
|
||||||
|
|
||||||
|
def test_serializable(self):
|
||||||
|
r = Results()
|
||||||
|
e = Entry()
|
||||||
|
ent = Entity()
|
||||||
|
e.entities.append(ent)
|
||||||
|
r.entries.append(e)
|
||||||
|
d = r.serializable()
|
||||||
|
assert d
|
||||||
|
assert d['entries']
|
||||||
|
assert d['entries'][0]['entities']
|
||||||
|
Loading…
Reference in New Issue
Block a user