summaryrefslogtreecommitdiff
path: root/tests/glibext/work.py
blob: 808e25e5b391f5fd5be5196c119b10481118fcb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

from chrysacase import ChrysalideTestCase
from pychrysalide.glibext import GenericWork


class TestWorks(ChrysalideTestCase):
    """TestCase for glibext.GenericWork"""

    def testBasicWorkImplementation(self):
        """Implement a basic work."""

        class BasicWork(GenericWork):
            def __init__(self, lst):
                super(BasicWork, self).__init__()
                self._lst = lst
            def _run(self):
                self._lst.append('done')

        test = []

        work = BasicWork(test)

        work.process()

        self.assertEqual(len(test), 1)
        self.assertEqual(test[0], 'done')