0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Python】Mock、MagicMock

Posted at

MagicMockには、モックの呼び出し状況を確認するメソッドがあります。

assert_called_once()は、モックが1回だけ呼ばれていた場合はNoneを返し、2回以上呼ばれていた場合はAssertionErrorを返します。

assert_called_with()は、指定した引数のモックが直前に呼ばれていた場合はNoneを返し、直前ではない場合、もしくは1回も呼ばれていない場合はAssertionErrorが返ります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?