<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>lazy_skunk</author_name>
  <author_url>https://blog.hatena.ne.jp/lazy_skunk/</author_url>
  <blog_title>ちんぱんの雑記</blog_title>
  <blog_url>https://lazy-skunk.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>mock を使うとき autospec=True を指定しておくと引数の渡し間違いなどに気づきやすくなる。 使える属性や引数の形を元のオブジェクトに合わせてくれるらしい。ただし、本物と同じ処理までしてくれるわけではない。 引数の数を間違えた場合 例えば次のようなクラスがあるとする。 class Calculator: def add(self, num1: int, num2: int) -&gt; int: return num1 + num2 次は autospec の有無を比べるための例。add の計算結果を検証するテストではないので、そこは勘弁してほしい。 from unittest imp…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Flazy-skunk.hatenablog.com%2Fentry%2F2024%2F04%2F17%2F223049&quot; title=&quot;mock を使うとき、autospec を併用するといいかも！ - ちんぱんの雑記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-04-17 22:30:49</published>
  <title>mock を使うとき、autospec を併用するといいかも！</title>
  <type>rich</type>
  <url>https://lazy-skunk.hatenablog.com/entry/2024/04/17/223049</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
