• Home
  • Raw
  • Download

Lines Matching refs:autospec

155 Auto-speccing can be done through the *autospec* argument to patch, or the
1058 .. function:: patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new…
1087 A more powerful form of *spec* is *autospec*. If you set ``autospec=True``
1097 Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an
1253 …target, attribute, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callabl…
1259 manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* and
1372 .. function:: patch.multiple(target, spec=None, create=False, spec_set=None, autospec=None, new_cal…
1387 manager. The arguments *spec*, *spec_set*, *create*, *autospec* and
2013 :func:`create_autospec` and the *autospec* argument to :func:`patch`.
2060 If the mock was created with a *spec* (or *autospec* of course) then all the
2247 Auto-speccing solves this problem. You can either pass ``autospec=True`` to
2249 mock with a spec. If you use the ``autospec=True`` argument to :func:`patch` then the
2259 >>> patcher = patch('__main__.request', autospec=True)
2294 In many cases you will just be able to add ``autospec=True`` to your existing
2298 As well as using *autospec* through :func:`patch` there is a
2308 spec object, autospec has to introspect (access attributes) the spec. As you
2312 able to use autospec. On the other hand it is much better to design your
2317 *autospec* can't know about any dynamically created attributes and restricts
2324 >>> with patch('__main__.Something', autospec=True):
2334 attributes on the mock after creation. Just because *autospec* doesn't allow
2338 >>> with patch('__main__.Something', autospec=True):
2343 There is a more aggressive version of both *spec* and *autospec* that *does*
2348 >>> with patch('__main__.Something', autospec=True, spec_set=True):
2371 autospec doesn't use a spec for members that are set to ``None``. These will
2387 alternative object as the *autospec* argument:
2396 >>> p = patch('__main__.Something', autospec=SomethingForTest)