Results of 1 - 1 of about 1 for TestFuncAcceptsSequencesMixin (0.003 sec.)
- test --- Python の回帰テストパッケージ 9414
- test --- Python の回帰テストパッケージ 注釈 test パッケージは Python 内部での使用のみを目的としています。 このドキュメントは Python のコア開発者向けに用意されています。 ここで説明するコードは Python のリリース間で予告なく変更または削除される
...以下のように、基本となるテストクラスを継承し、サブクラスで入力を指定することで、コードの重複を最小限に抑えてください。 class TestFuncAcceptsSequencesMixin : func = mySuperWhammyFunction def test_func ( self ): self . func ( self . arg ) class AcceptLists ( TestFuncAcceptsSeque...ncesMixin , unittest . TestCase ): arg = [ 1 , 2 , 3 ] class AcceptStrings ( TestFuncAcceptsSequencesMixin , unittest . TestCase ): arg = 'abc' class AcceptTuples ( TestFuncAcceptsSequencesMixin , unittest . TestCase ): arg = ( 1...このパターンを使うときは、 unittest.TestCase を継承するクラスがすべてテストとして実行されることに注意してください。 上の例の TestFuncAcceptsSequencesMixin クラスにはデータがなく、単独では実行できないため、 unittest.TestCase を継承していません。 参考 Test Driven Development コー... - https://man.mtool.work/python/3.14/library/test.html
PREV
1
NEXT