docs: #21 add missing docstrings
Add missing docstrings for scripts/tests.py
This commit is contained in:
parent
99d4f36bf6
commit
5de52855d1
1 changed files with 12 additions and 0 deletions
|
|
@ -1,3 +1,8 @@
|
||||||
|
"""
|
||||||
|
Unit tests for the scripts module
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
from unittest import TestCase, mock
|
from unittest import TestCase, mock
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
@ -25,18 +30,25 @@ class TestScript(BaseEvenniaTest):
|
||||||
mockinit.assert_called()
|
mockinit.assert_called()
|
||||||
|
|
||||||
class TestTickerHandler(TestCase):
|
class TestTickerHandler(TestCase):
|
||||||
|
""" Test the TickerHandler class """
|
||||||
|
|
||||||
def test_store_key_raises_RunTimeError(self):
|
def test_store_key_raises_RunTimeError(self):
|
||||||
|
""" Test _store_key method raises RuntimeError for interval < 1 """
|
||||||
with self.assertRaises(RuntimeError):
|
with self.assertRaises(RuntimeError):
|
||||||
th=TickerHandler()
|
th=TickerHandler()
|
||||||
th._store_key(None, None, 0, None)
|
th._store_key(None, None, 0, None)
|
||||||
|
|
||||||
def test_remove_raises_RunTimeError(self):
|
def test_remove_raises_RunTimeError(self):
|
||||||
|
""" Test remove method raises RuntimeError for catching old ordering of arguments """
|
||||||
with self.assertRaises(RuntimeError):
|
with self.assertRaises(RuntimeError):
|
||||||
th=TickerHandler()
|
th=TickerHandler()
|
||||||
th.remove(callback=1)
|
th.remove(callback=1)
|
||||||
|
|
||||||
class TestScriptDBManager(TestCase):
|
class TestScriptDBManager(TestCase):
|
||||||
|
""" Test the ScriptDBManger class """
|
||||||
|
|
||||||
def test_not_obj_return_empty_list(self):
|
def test_not_obj_return_empty_list(self):
|
||||||
|
""" Test get_all_scripts_on_obj returns empty list for falsy object """
|
||||||
manager_obj = ScriptDBManager()
|
manager_obj = ScriptDBManager()
|
||||||
returned_list = manager_obj.get_all_scripts_on_obj(False)
|
returned_list = manager_obj.get_all_scripts_on_obj(False)
|
||||||
self.assertEqual(returned_list, [])
|
self.assertEqual(returned_list, [])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue