Thanks to visit codestin.com
Credit goes to github.com

Skip to content

🌐 Add Korean translation for docs/ko/docs/advanced/async-test.md#12918

Merged
alejsdev merged 11 commits into
fastapi:masterfrom
icehongssii:master
Dec 10, 2024
Merged

🌐 Add Korean translation for docs/ko/docs/advanced/async-test.md#12918
alejsdev merged 11 commits into
fastapi:masterfrom
icehongssii:master

Conversation

@icehongssii

Copy link
Copy Markdown
Contributor

🌐Add korean translation for docs/ko/docs/advanced/async-test.md

@github-actions github-actions Bot added the lang-all Translations label Nov 13, 2024
@icehongssii icehongssii changed the title 🌐 Add translation for docs/ko/docs/advanced/async-test.md 🌐 Add translation for docs/ko/docs/advanced/async-test.md Nov 13, 2024
@github-actions

Copy link
Copy Markdown
Contributor

@alejsdev alejsdev changed the title 🌐 Add translation for docs/ko/docs/advanced/async-test.md 🌐 Add Korean translation for docs/ko/docs/advanced/async-test.md Nov 13, 2024
@alejsdev alejsdev added awaiting-review lang-ko Korean translations labels Nov 13, 2024
Comment thread docs/ko/docs/advanced/async-tests.md Outdated
Comment on lines +6 to +7
예를 들면 데이터베이스에 비동기로 쿼리하는 경우,
FastAPI 어플리케이션에 요청을 보내고 비동기 데이터 베이스 라이브러리를 사용해 백엔드 서버가 데이터베이스에 데이터를 성공적으로 작성했는지 확인하는 경우를 생각해봅시다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being able to use asynchronous functions in your tests could be useful

The above sentence needs to be included.

Comment thread docs/ko/docs/advanced/async-tests.md Outdated
Comment on lines +21 to +23
`TestClient`는 표준 pytest를 사용하여 비동기 FastAPI 애플리케이션을 일반적인 `def` 테스트 함수 내에서 호출할 수 있도록 내부적으로 마법 같은 처리를 합니다.

그러나 테스트를 비동기로 실행하면 더 이상 테스트 함수 내에서 `TestClient`를 사용할 수 없게 됩니다

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
`TestClient`는 표준 pytest를 사용하여 비동기 FastAPI 애플리케이션을 일반적인 `def` 테스트 함수 내에서 호출할 수 있도록 내부적으로 마법 같은 처리를 합니다.
그러나 테스트를 비동기로 실행하면 더 이상 테스트 함수 내에서 `TestClient`를 사용할 수 없게 됩니다
`TestClient`는 표준 pytest를 사용하여 비동기 FastAPI 애플리케이션을 일반적인 `def` 테스트 함수 내에서 호출할 수 있도록 내부적으로 마법 같은 처리를 합니다. 하지만 이 마법은 비동기 함수 내부에서 사용할 때는 더 이상 작동하지 않습니다. 테스트를 비동기적으로 실행하면, 더 이상 테스트 함수 내부에서 `TestClient`를 사용할 수 없습니다.

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

## 예시

간단한 예시를 위해 앞선 챕터 [Bigger Applications](../tutorial/bigger-applications.md){.internal-link target=_blank} 와 [Testing](../tutorial/testing.md){.internal-link target=_blank}:에서 다룬 파일 구조와 비슷한 형태를 확인해봅시다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
간단한 예시를 위해 앞선 챕터 [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.

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

{* ../../docs_src/async_tests/test_main.py hl[7] *}

/// tip

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// tip
/// tip | 팁

Comment thread docs/ko/docs/advanced/async-tests.md Outdated
│   └── test_main.py
```

`main.py` 파일에는 아래의 내용이 있습니다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`main.py` 파일에는 아래의 내용이 있습니다.
`main.py`는 아래와 같아야 합니다:

It's more natural, and don't miss the colon.

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

{* ../../docs_src/async_tests/main.py *}

`main.py` 의 테스트코드인 `test_main.py` 에는 아래의 내용이 있습니다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`main.py` 의 테스트코드인 `test_main.py` 에는 아래의 내용이 있습니다.
`test_main.py` 파일은 `main.py`에 대한 테스트가 있을 텐데, 다음과 같을 수 있습니다:

If you keep the nuance "would" and "could", it would be better.

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

{* ../../docs_src/async_tests/test_main.py *}

## Run it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed.

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

///

/// warning

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// warning
/// warning | 경고

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

테스트 함수가 이제 비동기 함수이므로, FastAPI 애플리케이션에 요청을 보내는 것 외에도 다른 `async` 함수를 호출하고 `await` 키워드를 사용 할 수 있습니다.

/// tip

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// tip
/// tip | 팁

@github-actions

Copy link
Copy Markdown
Contributor

@icehongssii

Copy link
Copy Markdown
Contributor Author

@hard-coders I appreciate your feedback! I've made the suggested changes as advised. Thanks again! (- - )(_ _) (- - ) 꾸벅

@github-actions

Copy link
Copy Markdown
Contributor

@hard-coders hard-coders left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job 👍🏻, but here are some missing points.

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

**FastAPI** 애플리케이션이 `async def` 대신 `def` 키워드로 선언된 함수를 사용하더라도, 내부적으로는 여전히 `비동기` 애플리케이션입니다.

`TestClient`는 표준 pytest를 사용하여 비동기 FastAPI 애플리케이션을 일반적인 `def` 테스트 함수 내에서 호출할 수 있도록 내부적으로 마법 같은 처리를 합니다. 하지만 이 마법은 비동기 함수 내부에서 사용할 때는 더 이상 작동하지 않습니다. 테스트를 비동기적으로 실행하면, 더 이상 테스트 함수 내부에서 `TestClient`를 사용할 수 없습니다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`TestClient`표준 pytest를 사용하여 비동기 FastAPI 애플리케이션을 일반적인 `def` 테스트 함수 내에서 호출할 수 있도록 내부적으로 마법 같은 처리를 합니다. 하지만 이 마법은 비동기 함수 내부에서 사용할 때는 더 이상 작동하지 않습니다. 테스트를 비동기적으로 실행하면, 더 이상 테스트 함수 내부에서 `TestClient`를 사용할 수 없습니다.
`TestClient`pytest 표준을 사용하여 비동기 FastAPI 애플리케이션을 일반적인 `def` 테스트 함수 내에서 호출할 수 있도록 내부에서 마술을 부립니다. 하지만 이 마술은 비동기 함수 내부에서 사용할 때는 더 이상 작동하지 않습니다. 테스트를 비동기로 실행하면, 더 이상 테스트 함수 내부에서 `TestClient`를 사용할 수 없습니다.

It's a suggestion, and I welcome feedback. 😃

먼저, "표준 pytest"는 마치 pytest가 표준인거 같은 느낌을 받습니다. de facto 일지는 모르나 표준은 아니며, 여기서는 pytest의 표준을 의미하므로 "pytest 표준"으로 바꿔서 혼선을 덜었으면 합니다.

그리고, "~적, ~적인"이란 표현이 반복됩니다.

  • "내부적으로" -> "내부에서"
  • "비동기적" -> "비동기"

과 같이 명확한 표현은 그대로 살렸으면 합니다.

@icehongssii icehongssii Nov 19, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I second this
Especially 표준 pytest -> pytest 내 표준

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

`TestClient`는 표준 pytest를 사용하여 비동기 FastAPI 애플리케이션을 일반적인 `def` 테스트 함수 내에서 호출할 수 있도록 내부적으로 마법 같은 처리를 합니다. 하지만 이 마법은 비동기 함수 내부에서 사용할 때는 더 이상 작동하지 않습니다. 테스트를 비동기적으로 실행하면, 더 이상 테스트 함수 내부에서 `TestClient`를 사용할 수 없습니다.

TestClient는 <a href="https://www.python-httpx.org" class="external-link" target="_blank">HTTPX</a>를 기반으로 하고 있으며, 다행히 이를 직접 사용하여 API를 테스트할 수 있습니다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

{* ../../docs_src/async_tests/test_main.py *}

## 실행 하기!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 실행 하기!
## 실행하기

The character ! does not exist, and fix 띄어쓰기

Comment thread docs/ko/docs/advanced/async-tests.md Outdated

/// 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 오류가 발생한다면, 이벤트 루프가 필요한 객체는 반드시 비동기 함수 내에서만 인스턴스화해야 한다는 점을 주의하세요!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
테스트에 비동기 함수 호출을 통합할 때 (예: <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

@github-actions

Copy link
Copy Markdown
Contributor

@hard-coders hard-coders left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@icehongssii

Copy link
Copy Markdown
Contributor Author

@hard-coders https://youtu.be/pHXDMe6QV-U?t=48

@alejsdev alejsdev enabled auto-merge (squash) November 19, 2024 12:10
@alejsdev

Copy link
Copy Markdown
Member

Thanks a lot for your contribution @icehongssii and help @hard-coders 🚀 ✨

@hard-coders

Copy link
Copy Markdown
Contributor

@alejsdev
The somehow/coverage check seems stuck for a week. Could you please check it?

@kwang1215 kwang1215 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@alejsdev alejsdev disabled auto-merge December 10, 2024 10:57
@github-actions

Copy link
Copy Markdown
Contributor

@alejsdev alejsdev merged commit f7ba75e into fastapi:master Dec 10, 2024
s-rigaud pushed a commit to s-rigaud/fastapi that referenced this pull request Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-1 lang-all Translations lang-ko Korean translations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants