MCPcopy Index your code
hub / github.com/python/cpython / test_selective_update

Method test_selective_update

Lib/test/test_functools.py:1014–1033  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1012 self.assertNotHasAttr(wrapper, 'attr')
1013
1014 def test_selective_update(self):
1015 def f():
1016 pass
1017 f.attr = 'This is a different test'
1018 f.dict_attr = dict(a=1, b=2, c=3)
1019 def add_dict_attr(f):
1020 f.dict_attr = {}
1021 return f
1022 assign = ('attr',)
1023 update = ('dict_attr',)
1024 @functools.wraps(f, assign, update)
1025 @add_dict_attr
1026 def wrapper():
1027 pass
1028 self.check_wrapper(wrapper, f, assign, update)
1029 self.assertEqual(wrapper.__name__, 'wrapper')
1030 self.assertNotEqual(wrapper.__qualname__, f.__qualname__)
1031 self.assertEqual(wrapper.__doc__, None)
1032 self.assertEqual(wrapper.attr, 'This is a different test')
1033 self.assertEqual(wrapper.dict_attr, f.dict_attr)
1034
1035
1036class TestReduce:

Callers

nothing calls this directly

Calls 3

check_wrapperMethod · 0.80
assertNotEqualMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected