about summary refs log tree commit diff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2020-07-24 01:43:26 +0300
committerBonfaceKilz2020-07-24 03:47:45 +0300
commitf95a42b0a9445a58e68fc83e9b1411bedef67904 (patch)
treecc8e2eb369442b32ea3d799237d739220ac6db0c /wqflask
parenta9282de4f07f37f120b165ff2650468e014f1984 (diff)
downloadgenenetwork2-f95a42b0a9445a58e68fc83e9b1411bedef67904.tar.gz
Add more tests for GeneralObject
* wqflask/tests/base/test_general_object.py: test object's magic methods
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/tests/base/test_general_object.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/wqflask/tests/base/test_general_object.py b/wqflask/tests/base/test_general_object.py
index 699cb079..df5791e0 100644
--- a/wqflask/tests/base/test_general_object.py
+++ b/wqflask/tests/base/test_general_object.py
@@ -12,6 +12,7 @@ class TestGeneralObjectTests(unittest.TestCase):
         """Test whether base contents are stored properly"""
         test_obj = GeneralObject("a", "b", "c")
         self.assertEqual("abc", ''.join(test_obj.contents))
+        self.assertEqual(len(test_obj), 0)
 
     def test_object_dict(self):
         """Test whether the base class is printed properly"""
@@ -19,3 +20,8 @@ class TestGeneralObjectTests(unittest.TestCase):
         self.assertEqual(str(test_obj), "value = 1\nname = test\n")
         self.assertEqual(
             repr(test_obj), "value = 1\nname = test\ncontents = ['a']\n")
+        self.assertEqual(len(test_obj), 2)
+        self.assertEqual(getattr(test_obj, "value"), 1)
+        self.assertEqual(test_obj["value"], 1)
+        test_obj["test"] = 1
+        self.assertEqual(test_obj["test"], 1)