Michael Merickel
2018-10-15 2b024920847481592b1a13d4006d2a9fa8881d72
commit | author | age
5babba 1 import unittest
CM 2
3 class TestReify(unittest.TestCase):
4     def _makeOne(self, wrapped):
b60bdb 5         from pyramid.decorator import reify
5babba 6         return reify(wrapped)
CM 7
8     def test___get__withinst(self):
9         def wrapped(inst):
10             return 'a'
11         decorator = self._makeOne(wrapped)
12         inst = Dummy()
13         result = decorator.__get__(inst)
14         self.assertEqual(result, 'a')
15         self.assertEqual(inst.__dict__['wrapped'], 'a')
16
17     def test___get__noinst(self):
462af2 18         def wrapped(inst):
3271c7 19             return 'a'  # pragma: no cover
462af2 20         decorator = self._makeOne(wrapped)
5babba 21         result = decorator.__get__(None)
CM 22         self.assertEqual(result, decorator)
23
462af2 24
5babba 25 class Dummy(object):
CM 26     pass