per page, with , order by , clip by
Results of 1 - 4 of about 4 for ProductionClass (0.012 sec.)
unittest.mock --- 入門 — Python 3.14.8 ドキュメント 11317
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- 入門 テーマ 自動 ライト ダーク | unittest.mock --- 入門 ¶ Added in version 3.3. Mock を使う ¶ Mock p ... や assert_called_once_with() メソッドを使ってそのメソッドが正しい引数で呼び出されたかどうかをチェックできます。 次の例では ProductionClass().method が something メソッドを呼び出したことをテストしています: >>> class ProductionClass : ... def method ( self ): ... ... self . something ( 1 , 2 , 3 ) ... def something ( self , a , b , c ): ... pass ... >>> real = ProductionClass () >>> real . something = MagicMock () >>> real . method () >>> real . something . assert_called_once_with ( 1 , 2 , 3 ) M ... をメソッド (またはテスト対象のシステムのどこか) に渡して、それが正しく利用されたかどうかをチェックする方法です。 次の例で、 ProductionClass は closer メソッドを持っています。このメソッドは渡されたオブジェクトの close メソッドを呼び出します。 >>> class Production ...
https://man.mtool.work/python/3.14/library/unittest.mock-examples.html
unittest.mock --- 入門 — Python 3.14.8 ドキュメント 10836
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- 入門 テーマ 自動 ライト ダーク | unittest.mock --- 入門 ¶ Added in version 3.3. Mock を使う ¶ Mock p ... や assert_called_once_with() メソッドを使ってそのメソッドが正しい引数で呼び出されたかどうかをチェックできます。 次の例では ProductionClass().method が something メソッドを呼び出したことをテストしています: >>> class ProductionClass : ... def method ( self ): ... ... self . something ( 1 , 2 , 3 ) ... def something ( self , a , b , c ): ... pass ... >>> real = ProductionClass () >>> real . something = MagicMock () >>> real . method () >>> real . something . assert_called_once_with ( 1 , 2 , 3 ) M ... をメソッド (またはテスト対象のシステムのどこか) に渡して、それが正しく利用されたかどうかをチェックする方法です。 次の例で、 ProductionClass は closer メソッドを持っています。このメソッドは渡されたオブジェクトの close メソッドを呼び出します。 >>> class Production ...
https://man.mtool.work/python/3.14/library/unittest.mock-examples.html
unittest.mock --- モックオブジェクトライブラリ — Python 3.14.8 ドキュメント 7397
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- モックオブジェクトライブラリ テーマ 自動 ライト ダーク | unittest.mock --- モックオブジェクトライブラ ... よび MagicMock を設定でき、どのよう使用されたかについてアサートできます: >>> from unittest.mock import MagicMock >>> thing = ProductionClass () >>> thing . method = MagicMock ( return_value = 3 ) >>> thing . method ( 3 , 4 , 5 , key = 'value' ) 3 >>> thing . meth ... 参照してください。 patch() デコレータと同様に with 文でコンテキストマネージャーとして使用できます: >>> with patch . object ( ProductionClass , 'method' , return_value = None ) as mock_method : ... thing = ProductionClass () ... thing . method ( 1 , 2 , 3 ) ... >> ... るのに便利な方法を提供します。 次の例では、 method が sentinel.some_object を返すようにモンキーパッチしています: >>> real = ProductionClass () >>> real . method = Mock ( name = "method" ) >>> real . method . return_value = sentinel . some_object >>> result = rea ...
https://man.mtool.work/python/3.14/library/unittest.mock.html
unittest.mock --- モックオブジェクトライブラリ — Python 3.14.8 ドキュメント 7397
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- モックオブジェクトライブラリ テーマ 自動 ライト ダーク | unittest.mock --- モックオブジェクトライブラ ... よび MagicMock を設定でき、どのよう使用されたかについてアサートできます: >>> from unittest.mock import MagicMock >>> thing = ProductionClass () >>> thing . method = MagicMock ( return_value = 3 ) >>> thing . method ( 3 , 4 , 5 , key = 'value' ) 3 >>> thing . meth ... 参照してください。 patch() デコレータと同様に with 文でコンテキストマネージャーとして使用できます: >>> with patch . object ( ProductionClass , 'method' , return_value = None ) as mock_method : ... thing = ProductionClass () ... thing . method ( 1 , 2 , 3 ) ... >> ... るのに便利な方法を提供します。 次の例では、 method が sentinel.some_object を返すようにモンキーパッチしています: >>> real = ProductionClass () >>> real . method = Mock ( name = "method" ) >>> real . method . return_value = sentinel . some_object >>> result = rea ...
https://man.mtool.work/python/3.14/library/unittest.mock.html
PREV 1 NEXT