2007-02-14から1日間の記事一覧
http://codespeak.net/py/current/doc/test.html#how-to-write-assertions-about-exceptions例外に関するテストを書くには、2つの書き方のどちらかを使えばいい。 py.test.raises(Exception, func, *args, **kwargs) py.test.raises(Exception, "func(*args,…
http://codespeak.net/py/current/doc/test.html#assert-with-the-assert-statement 表明を書くのは非常に簡単で、py.testの特筆すべき機能だ。 任意の式をassert文で評価すればいい。 例えば以下のようなテストが書ける。 assert hasattr(x, 'attribute') …