Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
メンバーシップや ID (例: 、 ) などの鼻に優しいアサーションのライブラリはありassert_contains(x, y)ますassert_is(a, b)か?
assert_contains(x, y)
assert_is(a, b)
Nose は、stdlib アサーションのスタンドアロン バージョンを提供します。
from nose.tools import assert_in, assert_is
古い Python の場合、unittest2 バージョンは、tools.py にあるものと同様の手法を使用してラップできる可能性があります。
Stdlib unittestはassertIn、 andとの両方を提供し、assertIsnose 経由で実行できます。それ以外のものをお探しですか?ところで、これらのメソッドは python 2.7 以降でのみ利用できます。古いバージョンの python でそれらが必要な場合は、unittest2パッケージから利用できます。
assertIn
assertIs