[Tutor] Mocking with "mock" in unit testing

Steven D'Aprano steve at pearwood.info
Sat Jan 18 01:49:34 CET 2014


On Fri, Jan 17, 2014 at 11:05:24AM -0500, Dave Angel wrote:
>  Steven D'Aprano <steve at pearwood.info> Wrote in message:

> > import mockimport 
> > unittestimport 
> > pinger
> > 
> > 
> > would not be "fine".
> > 
> > 
> You're putting the linefeeds in the wrong places.

Of course I am! 

You would be amazed at how long I had to stare at this before I even 
noticed the import suffix at the end of the first two lines. I had 
actually convinced myself that somehow two of the three "import" words 
had been deleted, not just whitespace.

It's all clear to me now, the raw HTML code in James' email had:

  <span style="color:rgb(255,119,0);font-weight:bold">import</span> mock
  <span style="color:rgb(255,119,0);font-weight:bold">import</span> <span 
  style="color:rgb(220,20,60)">unittest</span>
  <span style="color:rgb(255,119,0);font-weight:bold">import</span> pinger

(indentation added by me)

which got mangled into plain text as:

  import mockIMPORT unittestIMPORT pinger

(highlighting the latter two imports for emphasis), and not what my 
brain was telling me, which was "import mock unittest pinger".



-- 
Steven


More information about the Tutor mailing list