File: test__utils.py

package info (click to toggle)
python-pyforge 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 464 kB
  • sloc: python: 3,666; makefile: 12; sh: 7
file content (17 lines) | stat: -rw-r--r-- 669 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from .ut_utils import TestCase, ForgeTestCase
from forge.utils import renumerate, EXPECTING
from forge.class_mock_handle import ClassMockHandle

class RenumerateTest(TestCase):
    def test__simple_usage(self):
        self.assertEqual(list(renumerate(range(5))),
                          [(4, 4), (3, 3), (2, 2), (1, 1), (0, 0)])

class EXPECTING_Test(ForgeTestCase):
    def test(self):
        mocked = self.forge.create_wildcard_mock()
        handle = self.forge.create_mock(ClassMockHandle)
        mocked.__forge__ = handle
        handle.expect_setattr("foo", "bar")
        with self.forge.verified_replay_context():
            EXPECTING(mocked).foo = "bar"