Results of 1 - 10 of about 144 for something (0.015 sec.)
- unittest.mock --- 入門 — Python 3.14.8 ドキュメント 14118
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- 入門 テーマ 自動 ライト ダーク | unittest.mock --- 入門 ¶ Added in version 3.3. Mock を使う ¶ Mock p
...メソッドを使ってそのメソッドが正しい引数で呼び出されたかどうかをチェックできます。 次の例では 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 ) Mock for method calls on an object ¶ 上の例ではオブジェクトのメソッドに対して直接パ... - https://man.mtool.work/python/3.14/library/unittest.mock-examples.html
- unittest.mock --- 入門 — Python 3.14.8 ドキュメント 13858
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- 入門 テーマ 自動 ライト ダーク | unittest.mock --- 入門 ¶ Added in version 3.3. Mock を使う ¶ Mock p
...メソッドを使ってそのメソッドが正しい引数で呼び出されたかどうかをチェックできます。 次の例では 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 ) Mock for method calls on an object ¶ 上の例ではオブジェクトのメソッドに対して直接パ... - https://man.mtool.work/python/3.14/library/unittest.mock-examples.html
- unittest.mock --- モックオブジェクトライブラリ — Python 3.14.8 ドキュメント 9341
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- モックオブジェクトライブラリ テーマ 自動 ライト ダーク | unittest.mock --- モックオブジェクトライブラ
...相当します。設定は、 設定する値を伴った呼び出しになります。: >>> class Foo : ... @property ... def foo ( self ): ... return 'something' ... @foo . setter ... def foo ( self , value ): ... pass ... >>> with patch ( '__main__.Foo.foo' , new_callable = Propert...オブジェクトを io.StringIO インスタンスで置き換えることがあります: >>> from io import StringIO >>> def foo (): ... print ( 'Something' ) ... >>> @patch ( 'sys.stdout' , new_callable = StringIO ) ... def test ( mock_stdout ): ... foo () ... assert mock_stdo...ut . getvalue () == 'Something \n ' ... >>> test () patch() に mock を生成させる場合、たいてい最初に必要なことはその mock をセットアップすることです。幾ら... - https://man.mtool.work/python/3.14/library/unittest.mock.html
- unittest.mock --- モックオブジェクトライブラリ — Python 3.14.8 ドキュメント 9341
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- モックオブジェクトライブラリ テーマ 自動 ライト ダーク | unittest.mock --- モックオブジェクトライブラ
...相当します。設定は、 設定する値を伴った呼び出しになります。: >>> class Foo : ... @property ... def foo ( self ): ... return 'something' ... @foo . setter ... def foo ( self , value ): ... pass ... >>> with patch ( '__main__.Foo.foo' , new_callable = Propert...オブジェクトを io.StringIO インスタンスで置き換えることがあります: >>> from io import StringIO >>> def foo (): ... print ( 'Something' ) ... >>> @patch ( 'sys.stdout' , new_callable = StringIO ) ... def test ( mock_stdout ): ... foo () ... assert mock_stdo...ut . getvalue () == 'Something \n ' ... >>> test () patch() に mock を生成させる場合、たいてい最初に必要なことはその mock をセットアップすることです。幾ら... - https://man.mtool.work/python/3.14/library/unittest.mock.html
- Logging クックブック — Python 3.14.8 ドキュメント 7756
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » Logging クックブック テーマ 自動 ライト ダーク | Logging クックブック ¶ Author : Vinay Sajip <vinay_sajip at red-dove dot com> このページは、過去に
...gger . info ( 'created an instance of auxiliary_module.Auxiliary' ) logger . info ( 'calling auxiliary_module.Auxiliary.do_something' ) a . do_something () logger . info ( 'finished auxiliary_module.Auxiliary.do_something' ) logger . info ( 'calling auxil.... getLogger ( 'spam_application.auxiliary.Auxiliary' ) self . logger . info ( 'creating an instance of Auxiliary' ) def do_something ( self ): self . logger . info ( 'doing something' ) a = 1 + 1 self . logger . info ( 'done doing something' ) def some_fu...ce of auxiliary_module.Auxiliary 2005-03-23 23:47:11,668 - spam_application - INFO - calling auxiliary_module.Auxiliary.do_something 2005-03-23 23:47:11,668 - spam_application.auxiliary.Auxiliary - INFO - doing something 2005-03-23 23:47:11,669 - spam_app... - https://man.mtool.work/python/3.14/howto/logging-cookbook.html
- 7. 単純文 (simple statement) — Python 3.14.8 ドキュメント 7626
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python 言語リファレンス » 7. 単純文 (simple statement) テーマ 自動 ライト ダーク | 7. 単純文 (simple statement) ¶ 単純文とは、単一の論理行内に収められる文です。単
...ed, both exceptions will be printed: >>> try : ... print ( 1 / 0 ) ... except Exception as exc : ... raise RuntimeError ( "Something bad happened" ) from exc ... Traceback (most recent call last): File "<stdin>" , line 2 , in <module> print ( 1 / 0 ) ~~^~...of the following exception: Traceback (most recent call last): File "<stdin>" , line 4 , in <module> raise RuntimeError ( "Something bad happened" ) from exc RuntimeError : Something bad happened A similar mechanism works implicitly if a new exception is...ttached as the new exception's __context__ attribute: >>> try : ... print ( 1 / 0 ) ... except : ... raise RuntimeError ( "Something bad happened" ) ... Traceback (most recent call last): File "<stdin>" , line 2 , in <module> print ( 1 / 0 ) ~~^~~ ZeroDiv... - https://man.mtool.work/python/3.14/reference/simple_stmts.html
- 7. 単純文 (simple statement) — Python 3.14.8 ドキュメント 7626
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python 言語リファレンス » 7. 単純文 (simple statement) テーマ 自動 ライト ダーク | 7. 単純文 (simple statement) ¶ 単純文とは、単一の論理行内に収められる文です。単
...ed, both exceptions will be printed: >>> try : ... print ( 1 / 0 ) ... except Exception as exc : ... raise RuntimeError ( "Something bad happened" ) from exc ... Traceback (most recent call last): File "<stdin>" , line 2 , in <module> print ( 1 / 0 ) ~~^~...of the following exception: Traceback (most recent call last): File "<stdin>" , line 4 , in <module> raise RuntimeError ( "Something bad happened" ) from exc RuntimeError : Something bad happened A similar mechanism works implicitly if a new exception is...ttached as the new exception's __context__ attribute: >>> try : ... print ( 1 / 0 ) ... except : ... raise RuntimeError ( "Something bad happened" ) ... Traceback (most recent call last): File "<stdin>" , line 2 , in <module> print ( 1 / 0 ) ~~^~~ ZeroDiv... - https://man.mtool.work/python/3.14/reference/simple_stmts.html
- Coroutines and tasks — Python 3.14.8 ドキュメント 7354
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » ネットワーク通信とプロセス間通信 » asyncio --- 非同期 I/O » Coroutines and tasks テーマ 自動 ライト ダーク | Coroutines and tasks ¶
...クト を保護します。 aw がコルーチンだった場合、自動的に Task としてスケジュールされます。 文: task = asyncio . create_task ( something ()) res = await shield ( task ) は、以下と同じです res = await something () それを含むコルーチンがキャンセルされた場合を 除...き 、 something() 内で動作している Task はキャンセルされません。 something() 側から見るとキャンセルは発生しません。 呼び出し元がキャンセル...された場合でも、 "await" 式は CancelledError を送出します。 注意: something() が他の理由 (例えば、原因が自分自身) でキャンセルされた場合は shield() でも保護できません。 完全にキャンセルを無視したい場... - https://man.mtool.work/python/3.14/library/asyncio-task.html
- Logging クックブック — Python 3.14.8 ドキュメント 7354
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » Logging クックブック テーマ 自動 ライト ダーク | Logging クックブック ¶ Author : Vinay Sajip <vinay_sajip at red-dove dot com> このページは、過去に
...gger . info ( 'created an instance of auxiliary_module.Auxiliary' ) logger . info ( 'calling auxiliary_module.Auxiliary.do_something' ) a . do_something () logger . info ( 'finished auxiliary_module.Auxiliary.do_something' ) logger . info ( 'calling auxil.... getLogger ( 'spam_application.auxiliary.Auxiliary' ) self . logger . info ( 'creating an instance of Auxiliary' ) def do_something ( self ): self . logger . info ( 'doing something' ) a = 1 + 1 self . logger . info ( 'done doing something' ) def some_fu...ce of auxiliary_module.Auxiliary 2005-03-23 23:47:11,668 - spam_application - INFO - calling auxiliary_module.Auxiliary.do_something 2005-03-23 23:47:11,668 - spam_application.auxiliary.Auxiliary - INFO - doing something 2005-03-23 23:47:11,669 - spam_app... - https://man.mtool.work/python/3.14/howto/logging-cookbook.html
- Coroutines and tasks — Python 3.14.8 ドキュメント 7354
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » ネットワーク通信とプロセス間通信 » asyncio --- 非同期 I/O » Coroutines and tasks テーマ 自動 ライト ダーク | Coroutines and tasks ¶
...クト を保護します。 aw がコルーチンだった場合、自動的に Task としてスケジュールされます。 文: task = asyncio . create_task ( something ()) res = await shield ( task ) は、以下と同じです res = await something () それを含むコルーチンがキャンセルされた場合を 除...き 、 something() 内で動作している Task はキャンセルされません。 something() 側から見るとキャンセルは発生しません。 呼び出し元がキャンセル...された場合でも、 "await" 式は CancelledError を送出します。 注意: something() が他の理由 (例えば、原因が自分自身) でキャンセルされた場合は shield() でも保護できません。 完全にキャンセルを無視したい場... - https://man.mtool.work/python/3.14/library/asyncio-task.html