From f95a42b0a9445a58e68fc83e9b1411bedef67904 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Fri, 24 Jul 2020 01:43:26 +0300 Subject: Add more tests for GeneralObject * wqflask/tests/base/test_general_object.py: test object's magic methods --- wqflask/tests/base/test_general_object.py | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- cgit v1.2.3