@@ -512,9 +512,8 @@ this list of calls for us:
512512Partial mocking
513513~~~~~~~~~~~~~~~
514514
515- In some tests I wanted to mock out a call to `datetime.date.today()
516- <https://docs.python.org/library/datetime.html#datetime.date.today> `_ to return
517- a known date, but I didn't want to prevent the code under test from
515+ In some tests I wanted to mock out a call to :func: `datetime.date.today `
516+ to return a known date, but I didn't want to prevent the code under test from
518517creating new date objects. Unfortunately `datetime.date ` is written in C, and
519518so I couldn't just monkey-patch out the static `date.today ` method.
520519
@@ -556,14 +555,12 @@ is discussed in `this blog entry
556555Mocking a Generator Method
557556~~~~~~~~~~~~~~~~~~~~~~~~~~
558557
559- A Python generator is a function or method that uses the `yield statement
560- <https://docs.python.org/reference/simple_stmts.html#the-yield-statement> `_ to
561- return a series of values when iterated over [# ]_.
558+ A Python generator is a function or method that uses the :keyword: `yield ` statement
559+ to return a series of values when iterated over [# ]_.
562560
563561A generator method / function is called to return the generator object. It is
564562the generator object that is then iterated over. The protocol method for
565- iteration is `__iter__
566- <https://docs.python.org/library/stdtypes.html#container.__iter__> `_, so we can
563+ iteration is :meth: `~container.__iter__ `, so we can
567564mock this using a `MagicMock `.
568565
569566Here's an example class with an "iter" method implemented as a generator:
0 commit comments