• Home
  • Raw
  • Download

Lines Matching refs:autospec

171 Auto-speccing can be done through the *autospec* argument to patch, or the
1335 .. function:: patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new…
1366 A more powerful form of *spec* is *autospec*. If you set ``autospec=True``
1376 Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an
1537 …target, attribute, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callabl…
1543 manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* and
1686 .. function:: patch.multiple(target, spec=None, create=False, spec_set=None, autospec=None, new_cal…
1701 manager. The arguments *spec*, *spec_set*, *create*, *autospec* and
2337 :func:`create_autospec` and the *autospec* argument to :func:`patch`.
2390 If the mock was created with a *spec* (or *autospec* of course) then all the
2586 Auto-speccing solves this problem. You can either pass ``autospec=True`` to
2588 mock with a spec. If you use the ``autospec=True`` argument to :func:`patch` then the
2598 >>> patcher = patch('__main__.request', autospec=True)
2633 In many cases you will just be able to add ``autospec=True`` to your existing
2637 As well as using *autospec* through :func:`patch` there is a
2647 spec object, autospec has to introspect (access attributes) the spec. As you
2651 able to use autospec. On the other hand it is much better to design your
2656 *autospec* can't know about any dynamically created attributes and restricts
2663 >>> with patch('__main__.Something', autospec=True):
2673 attributes on the mock after creation. Just because *autospec* doesn't allow
2677 >>> with patch('__main__.Something', autospec=True):
2682 There is a more aggressive version of both *spec* and *autospec* that *does*
2687 >>> with patch('__main__.Something', autospec=True, spec_set=True):
2710 autospec doesn't use a spec for members that are set to ``None``. These will
2726 alternative object as the *autospec* argument::
2735 >>> p = patch('__main__.Something', autospec=SomethingForTest)