I was reading a technical blog post, and the post subtitle is: assert_called_once: Threat or Menace

I do not understood what the writer wanted to express with this synonyms. I mean, is there a popular (regional) joke with this words or just a pun?

And there is difference or particular in use of them?

  • 3
    I'd never heard of this, but google brings up this wikipedia article: en.wikipedia.org/wiki/Threat_or_menace – Sarah Jan 27 '16 at 18:31
  • 1
    It's a "nerd-talk" :) – InitK Jan 27 '16 at 20:02
  • 1
    @Sarah post research as an answer ;-) – Mauro Baraldi Jan 28 '16 at 0:13
  • I wouldn't have picked up on that either, but Sarah got it, it's clearly meant as humor. – whywasinotconsulted Jan 30 '16 at 1:52
  • 1
    @MauroBaraldi If you have found a satisfactory answer to your question, please mark it as answered so people looking for truly unanswered questions will not waste their time. – Peter Feb 8 '16 at 9:39
up vote 1 down vote accepted

It looks like you got this from a blog on Python unit testing here

The problem with the test seems to be that the test will pass when in reality it should not

The blog is about Test Driven Development where the test suite is used to ensure the underlying code is doing what it's supposed to do. TDD is more a feature of Ruby and Rails and is becoming more adapted for Python.

The fact that the title was named Threat or Menace is the directed towards the test itself:

assert_called_once

when the actual test is supposed to be

assert_called_once_with

which is the method supplied by Python Mock Library for server testing (in this case). However, the misspelling can still cause the test to pass even though there is a typo.

Which is not the best thing to happen

These oddities can happen when monkey patching is involved which seems to be the case.

[NB: I am not a Python person]

  • To have an answer from 2 doubts, from different categories, in only one post. Thank you Stack Exchange for make it possible! – Mauro Baraldi Feb 3 '16 at 17:21

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.