diff options
author | BonfaceKilz | 2020-07-24 01:43:26 +0300 |
---|---|---|
committer | BonfaceKilz | 2020-07-24 03:47:45 +0300 |
commit | f95a42b0a9445a58e68fc83e9b1411bedef67904 (patch) | |
tree | cc8e2eb369442b32ea3d799237d739220ac6db0c /wqflask/tests/base/test_general_object.py | |
parent | a9282de4f07f37f120b165ff2650468e014f1984 (diff) | |
download | genenetwork2-f95a42b0a9445a58e68fc83e9b1411bedef67904.tar.gz |
Add more tests for GeneralObject
* wqflask/tests/base/test_general_object.py: test object's magic methods
Diffstat (limited to 'wqflask/tests/base/test_general_object.py')
-rw-r--r-- | wqflask/tests/base/test_general_object.py | 6 |
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) |