aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/base/test_general_object.py
blob: 699cb079ce199e0d14e5e7717318b9dae83eeb8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import unittest

from base.GeneralObject import GeneralObject


class TestGeneralObjectTests(unittest.TestCase):
    """
    Test the GeneralObject base class
    """

    def test_object_contents(self):
        """Test whether base contents are stored properly"""
        test_obj = GeneralObject("a", "b", "c")
        self.assertEqual("abc", ''.join(test_obj.contents))

    def test_object_dict(self):
        """Test whether the base class is printed properly"""
        test_obj = GeneralObject("a", name="test", value=1)
        self.assertEqual(str(test_obj), "value = 1\nname = test\n")
        self.assertEqual(
            repr(test_obj), "value = 1\nname = test\ncontents = ['a']\n")