Repository navigation
π Add Korean translation for docs/ko/docs/advanced/async-test.md - #12918
Conversation
docs/ko/docs/advanced/async-test.md
|
π Docs preview for commit 4e9ba61 at: https://2b1a869e.fastapitiangolo.pages.dev Modified Pages |
docs/ko/docs/advanced/async-test.mddocs/ko/docs/advanced/async-test.md
| μλ₯Ό λ€λ©΄ λ°μ΄ν°λ² μ΄μ€μ λΉλκΈ°λ‘ μΏΌλ¦¬νλ κ²½μ°, | ||
| FastAPI μ΄ν리μΌμ΄μ μ μμ²μ 보λ΄κ³ λΉλκΈ° λ°μ΄ν° λ² μ΄μ€ λΌμ΄λΈλ¬λ¦¬λ₯Ό μ¬μ©ν΄ λ°±μλ μλ²κ° λ°μ΄ν°λ² μ΄μ€μ λ°μ΄ν°λ₯Ό μ±κ³΅μ μΌλ‘ μμ±νλμ§ νμΈνλ κ²½μ°λ₯Ό μκ°ν΄λ΄ μλ€. |
There was a problem hiding this comment.
Being able to use asynchronous functions in your tests could be useful
The above sentence needs to be included.
| `TestClient`λ νμ€ pytestλ₯Ό μ¬μ©νμ¬ λΉλκΈ° FastAPI μ ν리μΌμ΄μ μ μΌλ°μ μΈ `def` ν μ€νΈ ν¨μ λ΄μμ νΈμΆν μ μλλ‘ λ΄λΆμ μΌλ‘ λ§λ² κ°μ μ²λ¦¬λ₯Ό ν©λλ€. | ||
|
|
||
| κ·Έλ¬λ ν μ€νΈλ₯Ό λΉλκΈ°λ‘ μ€ννλ©΄ λ μ΄μ ν μ€νΈ ν¨μ λ΄μμ `TestClient`λ₯Ό μ¬μ©ν μ μκ² λ©λλ€ |
There was a problem hiding this comment.
But that magic doesn't work anymore when we're using it inside asynchronous functions. By running our tests asynchronously, we can no longer use the TestClient inside our test functions.
You should respect the original. It's oversimplified.
| `TestClient`λ νμ€ pytestλ₯Ό μ¬μ©νμ¬ λΉλκΈ° FastAPI μ ν리μΌμ΄μ μ μΌλ°μ μΈ `def` ν μ€νΈ ν¨μ λ΄μμ νΈμΆν μ μλλ‘ λ΄λΆμ μΌλ‘ λ§λ² κ°μ μ²λ¦¬λ₯Ό ν©λλ€. | |
| κ·Έλ¬λ ν μ€νΈλ₯Ό λΉλκΈ°λ‘ μ€ννλ©΄ λ μ΄μ ν μ€νΈ ν¨μ λ΄μμ `TestClient`λ₯Ό μ¬μ©ν μ μκ² λ©λλ€ | |
| `TestClient`λ νμ€ pytestλ₯Ό μ¬μ©νμ¬ λΉλκΈ° FastAPI μ ν리μΌμ΄μ μ μΌλ°μ μΈ `def` ν μ€νΈ ν¨μ λ΄μμ νΈμΆν μ μλλ‘ λ΄λΆμ μΌλ‘ λ§λ² κ°μ μ²λ¦¬λ₯Ό ν©λλ€. νμ§λ§ μ΄ λ§λ²μ λΉλκΈ° ν¨μ λ΄λΆμμ μ¬μ©ν λλ λ μ΄μ μλνμ§ μμ΅λλ€. ν μ€νΈλ₯Ό λΉλκΈ°μ μΌλ‘ μ€ννλ©΄, λ μ΄μ ν μ€νΈ ν¨μ λ΄λΆμμ `TestClient`λ₯Ό μ¬μ©ν μ μμ΅λλ€. |
|
|
||
| ## μμ | ||
|
|
||
| κ°λ¨ν μμλ₯Ό μν΄ μμ μ±ν° [Bigger Applications](../tutorial/bigger-applications.md){.internal-link target=_blank} μ [Testing](../tutorial/testing.md){.internal-link target=_blank}:μμ λ€λ£¬ νμΌ κ΅¬μ‘°μ λΉμ·ν ννλ₯Ό νμΈν΄λ΄ μλ€. |
There was a problem hiding this comment.
| κ°λ¨ν μμλ₯Ό μν΄ μμ μ±ν° [Bigger Applications](../tutorial/bigger-applications.md){.internal-link target=_blank} μ [Testing](../tutorial/testing.md){.internal-link target=_blank}:μμ λ€λ£¬ νμΌ κ΅¬μ‘°μ λΉμ·ν ννλ₯Ό νμΈν΄λ΄ μλ€. | |
| κ°λ¨ν μμλ₯Ό μν΄ [Bigger Applications](../tutorial/bigger-applications.md){.internal-link target=_blank} μ [Testing](../tutorial/testing.md){.internal-link target=_blank}μμ λ€λ£¬ νμΌ κ΅¬μ‘°μ λΉμ·ν ννλ₯Ό νμΈν΄λ΄ μλ€: |
Please translate the linked titles. Although they still have not been translated.
|
|
||
| {* ../../docs_src/async_tests/test_main.py hl[7] *} | ||
|
|
||
| /// tip |
There was a problem hiding this comment.
| /// tip | |
| /// tip | ν |
| βΒ Β βββ test_main.py | ||
| ``` | ||
|
|
||
| `main.py` νμΌμλ μλμ λ΄μ©μ΄ μμ΅λλ€. |
There was a problem hiding this comment.
| `main.py` νμΌμλ μλμ λ΄μ©μ΄ μμ΅λλ€. | |
| `main.py`λ μλμ κ°μμΌ ν©λλ€: |
It's more natural, and don't miss the colon.
|
|
||
| {* ../../docs_src/async_tests/main.py *} | ||
|
|
||
| `main.py` μ ν μ€νΈμ½λμΈ `test_main.py` μλ μλμ λ΄μ©μ΄ μμ΅λλ€. |
There was a problem hiding this comment.
| `main.py` μ ν μ€νΈμ½λμΈ `test_main.py` μλ μλμ λ΄μ©μ΄ μμ΅λλ€. | |
| `test_main.py` νμΌμ `main.py`μ λν ν μ€νΈκ° μμ ν λ°, λ€μκ³Ό κ°μ μ μμ΅λλ€: |
If you keep the nuance "would" and "could", it would be better.
|
|
||
| {* ../../docs_src/async_tests/test_main.py *} | ||
|
|
||
| ## Run it |
|
|
||
| /// | ||
|
|
||
| /// warning |
There was a problem hiding this comment.
| /// warning | |
| /// warning | κ²½κ³ |
|
|
||
| ν μ€νΈ ν¨μκ° μ΄μ λΉλκΈ° ν¨μμ΄λ―λ‘, FastAPI μ ν리μΌμ΄μ μ μμ²μ 보λ΄λ κ² μΈμλ λ€λ₯Έ `async` ν¨μλ₯Ό νΈμΆνκ³ `await` ν€μλλ₯Ό μ¬μ© ν μ μμ΅λλ€. | ||
|
|
||
| /// tip |
There was a problem hiding this comment.
| /// tip | |
| /// tip | ν |
|
π Docs preview for commit 749dc03 at: https://e92a9513.fastapitiangolo.pages.dev Modified Pages |
|
@hard-coders I appreciate your feedback! I've made the suggested changes as advised. Thanks again! (- - )(_ _) (- - ) κΎΈλ² |
|
π Docs preview for commit b798c15 at: https://7f1af5ee.fastapitiangolo.pages.dev Modified Pages |
hard-coders
left a comment
There was a problem hiding this comment.
Great job ππ», but here are some missing points.
|
|
||
| **FastAPI** μ ν리μΌμ΄μ μ΄ `async def` λμ `def` ν€μλλ‘ μ μΈλ ν¨μλ₯Ό μ¬μ©νλλΌλ, λ΄λΆμ μΌλ‘λ μ¬μ ν `λΉλκΈ°` μ ν리μΌμ΄μ μ λλ€. | ||
|
|
||
| `TestClient`λ νμ€ pytestλ₯Ό μ¬μ©νμ¬ λΉλκΈ° FastAPI μ ν리μΌμ΄μ μ μΌλ°μ μΈ `def` ν μ€νΈ ν¨μ λ΄μμ νΈμΆν μ μλλ‘ λ΄λΆμ μΌλ‘ λ§λ² κ°μ μ²λ¦¬λ₯Ό ν©λλ€. νμ§λ§ μ΄ λ§λ²μ λΉλκΈ° ν¨μ λ΄λΆμμ μ¬μ©ν λλ λ μ΄μ μλνμ§ μμ΅λλ€. ν μ€νΈλ₯Ό λΉλκΈ°μ μΌλ‘ μ€ννλ©΄, λ μ΄μ ν μ€νΈ ν¨μ λ΄λΆμμ `TestClient`λ₯Ό μ¬μ©ν μ μμ΅λλ€. |
There was a problem hiding this comment.
| `TestClient`λ νμ€ pytestλ₯Ό μ¬μ©νμ¬ λΉλκΈ° FastAPI μ ν리μΌμ΄μ μ μΌλ°μ μΈ `def` ν μ€νΈ ν¨μ λ΄μμ νΈμΆν μ μλλ‘ λ΄λΆμ μΌλ‘ λ§λ² κ°μ μ²λ¦¬λ₯Ό ν©λλ€. νμ§λ§ μ΄ λ§λ²μ λΉλκΈ° ν¨μ λ΄λΆμμ μ¬μ©ν λλ λ μ΄μ μλνμ§ μμ΅λλ€. ν μ€νΈλ₯Ό λΉλκΈ°μ μΌλ‘ μ€ννλ©΄, λ μ΄μ ν μ€νΈ ν¨μ λ΄λΆμμ `TestClient`λ₯Ό μ¬μ©ν μ μμ΅λλ€. | |
| `TestClient`λ pytest νμ€μ μ¬μ©νμ¬ λΉλκΈ° FastAPI μ ν리μΌμ΄μ μ μΌλ°μ μΈ `def` ν μ€νΈ ν¨μ λ΄μμ νΈμΆν μ μλλ‘ λ΄λΆμμ λ§μ μ λΆλ¦½λλ€. νμ§λ§ μ΄ λ§μ μ λΉλκΈ° ν¨μ λ΄λΆμμ μ¬μ©ν λλ λ μ΄μ μλνμ§ μμ΅λλ€. ν μ€νΈλ₯Ό λΉλκΈ°λ‘ μ€ννλ©΄, λ μ΄μ ν μ€νΈ ν¨μ λ΄λΆμμ `TestClient`λ₯Ό μ¬μ©ν μ μμ΅λλ€. |
It's a suggestion, and I welcome feedback. π
λ¨Όμ , "νμ€ pytest"λ λ§μΉ pytestκ° νμ€μΈκ±° κ°μ λλμ λ°μ΅λλ€. de facto μΌμ§λ λͺ¨λ₯΄λ νμ€μ μλλ©°, μ¬κΈ°μλ pytestμ νμ€μ μλ―Ένλ―λ‘ "pytest νμ€"μΌλ‘ λ°κΏμ νΌμ μ λμμΌλ©΄ ν©λλ€.
κ·Έλ¦¬κ³ , "~μ , ~μ μΈ"μ΄λ ννμ΄ λ°λ³΅λ©λλ€.
- "λ΄λΆμ μΌλ‘" -> "λ΄λΆμμ"
- "λΉλκΈ°μ " -> "λΉλκΈ°"
κ³Ό κ°μ΄ λͺ νν ννμ κ·Έλλ‘ μ΄λ ΈμΌλ©΄ ν©λλ€.
There was a problem hiding this comment.
I second this
Especially νμ€ pytest -> pytest λ΄ νμ€
|
|
||
| `TestClient`λ νμ€ pytestλ₯Ό μ¬μ©νμ¬ λΉλκΈ° FastAPI μ ν리μΌμ΄μ μ μΌλ°μ μΈ `def` ν μ€νΈ ν¨μ λ΄μμ νΈμΆν μ μλλ‘ λ΄λΆμ μΌλ‘ λ§λ² κ°μ μ²λ¦¬λ₯Ό ν©λλ€. νμ§λ§ μ΄ λ§λ²μ λΉλκΈ° ν¨μ λ΄λΆμμ μ¬μ©ν λλ λ μ΄μ μλνμ§ μμ΅λλ€. ν μ€νΈλ₯Ό λΉλκΈ°μ μΌλ‘ μ€ννλ©΄, λ μ΄μ ν μ€νΈ ν¨μ λ΄λΆμμ `TestClient`λ₯Ό μ¬μ©ν μ μμ΅λλ€. | ||
|
|
||
| TestClientλ <a href="https://www.python-httpx.org" class="external-link" target="_blank">HTTPX</a>λ₯Ό κΈ°λ°μΌλ‘ νκ³ μμΌλ©°, λ€νν μ΄λ₯Ό μ§μ μ¬μ©νμ¬ APIλ₯Ό ν μ€νΈν μ μμ΅λλ€. |
There was a problem hiding this comment.
| TestClientλ <a href="https://www.python-httpx.org" class="external-link" target="_blank">HTTPX</a>λ₯Ό κΈ°λ°μΌλ‘ νκ³ μμΌλ©°, λ€νν μ΄λ₯Ό μ§μ μ¬μ©νμ¬ APIλ₯Ό ν μ€νΈν μ μμ΅λλ€. | |
| `TestClient`λ <a href="https://www.python-httpx.org" class="external-link" target="_blank">HTTPX</a>λ₯Ό κΈ°λ°μΌλ‘ νκ³ μμΌλ©°, λ€νν μ΄λ₯Ό μ§μ μ¬μ©νμ¬ APIλ₯Ό ν μ€νΈν μ μμ΅λλ€. |
Missing backtick.
|
|
||
| {* ../../docs_src/async_tests/test_main.py *} | ||
|
|
||
| ## μ€ν νκΈ°! |
There was a problem hiding this comment.
| ## μ€ν νκΈ°! | |
| ## μ€ννκΈ° |
The character ! does not exist, and fix λμ΄μ°κΈ°
|
|
||
| /// tip | ν | ||
|
|
||
| ν μ€νΈμ λΉλκΈ° ν¨μ νΈμΆμ ν΅ν©ν λ (μ: <a href="https://stackoverflow.com/questions/41584243/runtimeerror-task-attached-to-a-different-loop" class="external-link" target="_blank">MongoDBμ MotorClient</a>λ₯Ό μ¬μ©ν λ) RuntimeError: Task attached to a different loop μ€λ₯κ° λ°μνλ€λ©΄, μ΄λ²€νΈ 루νκ° νμν κ°μ²΄λ λ°λμ λΉλκΈ° ν¨μ λ΄μμλ§ μΈμ€ν΄μ€νν΄μΌ νλ€λ μ μ μ£ΌμνμΈμ! |
There was a problem hiding this comment.
| ν μ€νΈμ λΉλκΈ° ν¨μ νΈμΆμ ν΅ν©ν λ (μ: <a href="https://stackoverflow.com/questions/41584243/runtimeerror-task-attached-to-a-different-loop" class="external-link" target="_blank">MongoDBμ MotorClient</a>λ₯Ό μ¬μ©ν λ) RuntimeError: Task attached to a different loop μ€λ₯κ° λ°μνλ€λ©΄, μ΄λ²€νΈ 루νκ° νμν κ°μ²΄λ λ°λμ λΉλκΈ° ν¨μ λ΄μμλ§ μΈμ€ν΄μ€νν΄μΌ νλ€λ μ μ μ£ΌμνμΈμ! | |
| ν μ€νΈμ λΉλκΈ° ν¨μ νΈμΆμ ν΅ν©ν λ (μ: <a href="https://stackoverflow.com/questions/41584243/runtimeerror-task-attached-to-a-different-loop" class="external-link" target="_blank">MongoDBμ MotorClient</a>λ₯Ό μ¬μ©ν λ) `RuntimeError: Task attached to a different loop` μ€λ₯κ° λ°μνλ€λ©΄, μ΄λ²€νΈ 루νκ° νμν κ°μ²΄λ λ°λμ λΉλκΈ° ν¨μ λ΄μμλ§ μΈμ€ν΄μ€νν΄μΌ νλ€λ μ μ μ£ΌμνμΈμ! |
missing backtick
|
π Docs preview for commit a59bbd2 at: https://1b8c70e3.fastapitiangolo.pages.dev Modified Pages |
|
Thanks a lot for your contribution @icehongssii and help @hard-coders π β¨ |
|
@alejsdev |
|
π Docs preview for commit ad91c32 at: https://97d59428.fastapitiangolo.pages.dev Modified Pages |
|
π Docs preview for commit 949b01c at: https://26a122ac.fastapitiangolo.pages.dev Modified Pages |
|
π Docs preview for commit 949b01c at: https://376d5622.fastapitiangolo.pages.dev Modified Pages |
πAdd korean translation for docs/ko/docs/advanced/async-test.md